Question: Task: The following algorithm has been implemented as an LMC program; however, the LMC program does not behave as expected and the developer has not

Task: The following algorithm has been implemented as an LMC program; however, the LMC program does not behave as expected and the developer has not indented or commented on the code making readability difficult.
Algorithm
CountItemsGreaterThanX
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
LMC program
IN
STO INPUTCOUNT
IN STO X
LOOPSTART: LDA LOOPCOUNT
ADD ONE
STO LOOPCOUNT
LDA INPUTCOUNT
SUB LOOPCOUNT
BR CONTINUELOOP
BR LOOPEND
CONTINUELOOP: IN
SUB X
BRP COUNTINC
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
2.1. To understand the LMC program, identify the errors and correct the given program so that the implementation matches the algorithm.
2.2. Describe the changes that you make and provide reasons for the changes in the provided template.
2.3. Write a test suite to be used to verify that the updated program is correct.
2.4. Use your test suite to demonstrate that the program is correct.
2.5. Provide indentation and comments in the LMC program where necessary.

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 Databases Questions!