Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Ive got 99 problems but Java aint one of them. You will write a program that asks a user how many problems they have- In
Ive got 99 problems but Java aint one of them.
You will write a program that asks a user how many problems they have- In your prompt
instruct them to enter a number between 3 and 99. (Check to make sure they comply.)
You will then print a line for each of their problems finishing off with a line saying they
have no problems.
You will then ask if they have any more problems to start the process again.
Finish your program with a pleasant output line to let the user know he/she is done.
Hints:
You need to account for the difference between 1 problem and 2 or more problems.
Since you are using inputs of an integer and a string value you may consider either 2
scanner objects or you will have to parse the integer out of a string.
If your outer loop repeats on an input of yes or y then make sure to use the
scannerName.equals rather than the == syntax.
Example output:
How many problems do you have? (Enter a number 3-99) 2
Im sorry you need to enter a number between 3 and 99,
please re-enter an integer in that range.
How many problems do you have? (Enter a number 3-99) 4
You have 4 problems but Java ain't one
You have 3 problems but Java ain't one
You have 2 problems but Java ain't one
You have 1 problem but Java ain't one
54 You got no problems left.
55 Do you want more problems: Yes or No?
56 yes
57 How many problems do you have? (Enter a number 3-99) 3
58 You have 3 problems but Java ain't one
59 You have 2 problems but Java ain't one
60 You have 1 problem but Java ain't one
61 You got no problems left.
62 Do you want more problems: Yes or No?
63 no
64 I'm glad you are OK.*/
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