Image one is my code, I wanted to make some change to the blue part's code. The code I written in red(see image 1) is the method to check that an integer has exactly 5 digits is provided for you (fiveDigits). You just need to call it appropriately in your code(the part in blue square)! Notice that the fiveDigits method returns a boolean - think carefully about how you should use this return type to reprompt the user until they enter a valid zip code. And I want the same output be like (see image 2)
Image one is my code, I wanted to make some change to the blue part's code.
The code I written in red(see image 1) is the method to check that an integer has exactly 5 digits is provided for you (fiveDigits). You just need to call it appropriately in your code(the part in blue square)! Notice that the fiveDigits method returns a boolean - think carefully about how you should use this return type to reprompt the user until they enter a valid zip code.
And I want the same output be like (see image 2)
for the invalid zip code part: I should only reprompt the user with the message "Invalid zip-code, enter valid zip-code: " until they enter a valid zip code. Similarly, if the user enters an invalid pain level, you should reprompt the user with the message "Invalid pain level, enter valid pain level (1-10): " until they enter a valid pain level. For example(image2)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 6 images
But for the name == quit, you are still using the break, can you also change that one too?
We can't use "break" in this code, can you change to other ways to do it?
(maybe use if or if else or if else if)
plz provide a screenshot of the code and out put .
Thanks
Thank you, but we don't allowed to use the "break", is there any other way to do it? (Maybe use if or else if)?
also plz provide a screenshot of the code and output.