IT 210 Week 6 Assignment Verifying a Algorithm

profilekhiylie301
it210_worksheet_i.docx

University of Phoenix Associates Program Material (revised by Albert Mink)

Worksheet I

Algorithm Verification

Examine the following test score program that contains a multiple-alternative selection control structure:

Main Module

Declare X As Integer

Write “Enter an Integer test score from 0 to 100”

Input X

If (X >= 0 AND X < 49) Then

Write "You fail" Else

If (X >= 50 AND X < 70) Then

Write "Your grade is " + X

Write "You did OK" Else

If (X >= 70 AND X < 85) Then

Write "Your grade is " + X

Write "You did well" Else

If (X >= 85 AND X < 100) Then

Write "Your grade is " + X

Write "You did great" End If

End If

End If

End If

Write "How did you do?"

End Program

Please answer the questions in the following table:

Questions

Answers

1. If the user input to the program is -1, what will be the exact output of the program?

2. If the user input to the program is 0, what will be the exact output of the program?

3. If the user input to the program is 49, what will be the exact output of the program?

4. If the user input to the program is 51, what will be the exact output of the program?

5. If the user input to the program is 100, what will be the exact output of the program?

6. If the user input to the program is “Wingding”, what will be the exact output of the program?

7. An input of 40 will cause the first If statement to be executed. What input values will cause each of the other three If statements to be executed?

8. A program that is robust is able to handle all input values of a certain type, even input values that are not expected. To demonstrate that this program is not robust, what possible integer input values does this program not handle with one of the If statements?

9. To demonstrate that this program is not robust, what are some non-numeric input values that this program will not handle?

IT 210