Question: Write a Java program that asks the user if he/she likes Java programming. If the user answers yes, then it displays a congratulating message (use
Write a Java program that asks the user if he/she likes Java programming. If the user answers yes, then it displays a congratulating message (use your imagination), and terminates.
Now, if the user answers no, then the fun starts. The program should ask Are you sure you don't like Java programming?. If the user answers no, then it should display Hope you'll get to like it soon.. Otherwise, if the user answers yes, it should ask Are you really sure you don't like Java programming?, and repeat. If the user keeps saying yes, then the program keeps asking Are you really really sure you don't like Java programming?, then Are you really really really sure you don't like Java programming?. And so on, every time printing one more really.
This should stop when it reaches the point when it prints really 5 times. At that point, if the user still answers yes, it should print Too bad, and terminate.
Do you like Java programming? [y/n]: n Are you sure you don't like Java programming? [y/n]: y Are you really sure you don't like Java programming? [y/n]: y Are you really really sure you don't like Java programming? [y/n]: n Hope you'll get to olike it soon..
Do you like Java programming? [y/n]: n Are you sure you don't like Java programming? [y/n]: y Are you really sure you don't like Java programming? [y/n]: y Are you really really sure you don't like Java programming? [y/n]: y Are you really really really sure you don't like Java programming? [y/n]: y Are you really really really really sure you don't like Java programming? [y/n]: y Are you really really really really really sure you don't like Java programming? [y/n]: y Too bad..
*Do not use arrays. Please use for loops.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
