Question: The following algorithm has been implemented as an LMC program, however, the program does not behave as expected. A part of your task is to

The following algorithm has been implemented as
The following algorithm has been implemented as an LMC program, however, the program does not behave as expected. A part of your task is to debug the program so that the implementation matches the algorithm. You must describe the change(s) that you make and provide insight as to why you made them/it. Write a test suite to demonstrate that the fixes are correct. Hint: the changes required are small. Do not rewrite the entirety or sections of the code. Countitems GreaterThanX n * user-specified number of items x * user-specified value for X c + count of items greater than X while n is greater than 0 m +user-specified item if m > x C=C+1 n=n - 1 Display the count, c Below is the code. Unfortunately, the developer has not indented or commented their code, so readability is low. A part of your task is to tidy and comment the code. The LMC code is available on Blackboard as "Question2.txt", and is below for your own reference. It is strongly recommended that you do not copy and paste from here as Office Word is known for incorrectly formatting code; you should use the code available on Blackboard. IN STO INPUTCOUNT IN STO X LOOPSTART: LDA LOOPCOUNT ADD ONE STO LOC LDA INPUTCOUNT SUB LOOPCOUNT BR CONTINUELOOP BR LOOPEND CONTINUELOOP: IN SUB X BRP COUNTING BR LOOPSTART COUNTINC: LDA NUMITEMSGREATER ADD ONE STO NUMITEMSGREATER BR LOOPSTART LOPEND: LDA NUMITEMSGREATER OUT HLT INPUTCOUNT: DAT 000 LOOPCOUNT: DAT 000 NUMITEMSGREATER: DAT 000 ONE: DAT 000 X: DAT 000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!