Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this exercise, you'll modify the while loop in the Guess the Number application so it doesn't use the break or continue statements. Open and
In this exercise, you'll modify the while loop in the Guess the Number application so it doesn't use the break or continue statements.
Open and run the project
Open the project named chexGuessNumber that's stored in the exstarts folder. Then, run the application to see how it works.
Remove the break statement
Modify the while loop so its Boolean expression checks that the guess and number variables aren't equal. To do that, you need to declare the guess variable outside the loop.
Move the statement that notifies the user of the correct guess so it executes after the while loop is finished.
Delete the else clause of the ifelse statement.
Move the code that increments the counter variable so it's only executed if the guess is too high or too low, not if the guess is the correct number.
Run the application and test it to make sure it still works correctly.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started