Question: The following directions will create a program that prompts the user to enter a number between 1 and 1 0 . As long as the

The following directions will create a program that prompts the user to enter a number between 1
and 10. As long as the number is out of range the program re-prompts the user for a valid number.
Complete the following steps to write this code.
a. Write a line of code the prompts the user for number between 1 and 10.
b. Write a Boolean expression that tests the number the user entered by the code in step "a."
to determine if it is not in range.
c. Use the Boolean expression created in step "b." to write a while loop that executes when
the user input is out of range. The body of the loop should tell the user that they entered
an invalid number and prompt them for a valid number again.
d. Write a line of code that prints a message telling the user that they entered a valid
number.
e. Put the segments of code from steps "a-d" together. Enter and execute the code. Does it
work properly? If not, correct it and test it again.
f. How many times does the loop execute?
The following directions will create a program

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