# CMIS 102 deskcheck walk through example week 5 Essay

Submitted By Willie-Ferguson
Words: 847
Pages: 4

Week 5 – More Help with walkthroughs (deskchecks)
The code below is code from a student. It is to add any number of credits and debits to be applied to an account. We are asked to do a walkthrough of our code this week. This is the same as saying to do a deskcheck. I have shown deskchecks in week 2in my material loaded to the course. The code below has another example of a descheck (walkthrough). You can always check your work like this and be sure of if it works before you ever run it. You actually become the compiler!
This program is a good effort but could use an added print statement between lines 9 and 10 that says “Please enter a debt or a credit and a zero when you wish to stop”

Deskcheck or Walk Through Table …

Line
Purpose
variables

num credit debt run netTotal
Output
1.
Make I/O functions available to us eon my program

2.
Make Boolean functions available

3.
Starts the main module

4.
Declare my variables

5.
Credit = 0

0

6.
Debt = 0

0

7.
Run = declared – this would be better to be declared at the top with the other variables

8.
Run = true

true

9.
While run is = true do all the code between the while and the endwhile bracket on line 14

10.
Input a number from the keyboard – it would be better to first print a message to the screen asking the user for input first – lets say 10 is entered
10

11.
Num is not equal to 0 so run is not set to false

12.
Num is > 0 so credit = credit + num

10

13.
This line is skipped because a true condition was found in the IF statement so it will not jump to last line after the IF which is the bracket to end the while loop on line 14

14.
} ends the while loop so logic execution is sent back up to the top of the while loop on line 9 to see if the condition is still true – run is still equal to true – we can see this by looking at the run column and it is still equal to true so the code runs again inside the loop

9.
Condition is true so we fall back in loop

10.
We input a new number – let us say it is -7 – note that num was 10 and now the 10 is gone and num is -7
-7

11.
Num is not equal to 0 so run is not set to false

12.
Num is not > 0 so this line does not execute

13.
This line executes now because the first two lines of the IF statement were false and this is the last option and it adds num to debt

-7

14.
} ends the while loop so logic execution is sent back up to the top of the while loop on line 9 to see if the condition is still true – run is still equal to true – we can see this by looking at the run column and it is still equal to true so the code runs again inside the loop

9.
Condition is true so we fall back in loop

10.
We input a new number – let us