Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

In Java Please Write a program that selects two random numbers -20 to 20. The two numbers would get displayed with + between

In Java Please Write a program that selects two random numbers -20 to 20. The two numbers would get displayed with " + " between them followed by "= ". The user should enter the sum of the two numbers. The program should print "Incorrect" if the user enters a wrong answer and re-prompts the user to re-enter the answer again. Limit the number of incorrect tries to 3. After 3 incorrect tries print the correct answer. The program should print a message like "Correct!" if the user enters the right answer.

The program would then display "Would you like another problem y/n? ". If user selects "y" or "Y" you show them another problem to be solved. -10 + 19 = 8 Incorrect. The correct answer is 9 Would you like another problem y/n? f Don't understand f Would you like another problem y/n? n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

9:17

Answered: 1 week ago