In: Computer Science
- Part 2 – 4 Desk Checking Exercises – these are 3 programs (pseudocode) that are working and 1 program (Python). Explainthe intent of the pseudocode / program. If you use test data, note the test data. . You are NOT trying to find mistakes
What does this do? Desk
Checking #3: Explain the intent of this
pseudocode. Be as specific as
possible.
List the data you use for example data.
Use this textbox to explain the pseudocode/ code intent. Include any test data used: |
start
Declarations
num idNumber
num itemsSold
num itemsValue
num ITEM_MIN = 200
num VALUE_MIN = 1000
string MSG = “High Performer!”
housekeeping()
detail()
finish()
stop
housekeeping()
output “Salesperson program”
input idNumber, itemsSold, itemsValue
return
detail()
if itemsSold > ITEM_MIN AND itemsValue > VALUE_MIN then
output MSG
return
finish()
output “End of program”
return
So to get this psuedo code understanable better, i will give you an example and go through the all the steps to make it easy . I have used 2 example below with values please go thourgh all
Let me explain the methods first and declarations:
Declarations
num idNumber //declaring num type variable with name idNumber
num itemsSold //declaring num type variable with name itemsSold
num itemsValue //declaring num type variable with name itemsValue
num ITEM_MIN = 200 //declaring num type variable with name ITEM_MIN and initializing with value 200
num VALUE_MIN = 1000 //declaring num type variable with name VALUE_MIN and initializing with value 1000
string MSG = “High Performer!” //declaring string type variable with name MSG and initializing with value High Performer!
housekeeping() :
detail() : This method will check for the following case that,
finish()
Example:
After declarations and initializing the variables in the Declarations window, the 1st method that called is housekeeping()
This method prints output Salesperson program and reads the values for below variables
Lets take here that user input the following values :
Then detail() method will be called and process happens as below
Then it returns and execute finish() Which will output End of program and returns
Then program will stop
Example 2:
After declarations and initializing the variables in the Declarations window, the 1st method that called is housekeeping()
This method prints output Salesperson program and reads the values for below variables
Lets take here that user input the following values :
Then detail() method will be called and process happens as below
Then it returns and execute finish() Which will output End of program and returns
Then program will stop