Sample Exam 2

Problem 2a

For this problem, the project can be found in the folder SE2-2a.

The main program arbitrarily chooses bounds for the typists. You need to write a method that

a) uses these bounds as input and
b) returns an integer that is within these bounds.
You need to
a) write a method that verifies that a typist has entered an integer value within the inclusive bounds
b) write method calls (within the main program) that invoke this method to produce the correct result.

Sample Output:
 

Sample Exam2 - Problem 2a

Test 1
The bounds are set at 5 and 5000
Please enter a number between 5 and 5000 inclusive: 4
Sorry, the number must be within the range of 5 and 500
Please try again 5005
Sorry, the number must be within the range of 5 and 500
Please try again 4444
The value from the typist is 4444

Test 2
The bounds are set at 50 and 500
Please enter a number between 50 and 500 inclusive: 45
Sorry, the number must be within the range of 50 and 50
Please try again 4444
Sorry, the number must be within the range of 50 and 50
Please try again 50
The value from the typist is 50