Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA PROGRAM - no functions/methods Display the menu shown below and get the users choice. 1. Addition 2. Subtraction (first operand larger) 3. Subtraction (first

JAVA PROGRAM - no functions/methods

Display the menu shown below and get the users choice.

1. Addition

2. Subtraction (first operand larger)

3. Subtraction (first operand smaller)

4. Multiplication

5. Exit the program

If the user does not enter a valid choice, output "Valid choices are 1-5; please re-enter"

Get the lower and upper bound values the user wants to use for the math problems. Any integer values can be used. Upper bound must be greater than the lower bound. If the value entered for the upper bound is not greater than the lower bound, output an "upper bound must be > lower bound" and prompt for another value to be entered.

Display 5 problems of the user-requested type. For instance, if the user chooses option 1, your program should display an addition problem, using randomly-generated operands between the lower bound and the upper bound. Then it should get the users answer, check the answer and output message based on whether or not it is correct(if the answer was incorrect, the message should include the correct answer). Display problem/get answer/check answer steps should repeat a total of five times.

Repeat steps 1, 2, and 3 until the user chooses the exit option.

Keep track of the number of problems attempted and the number of problems correct. When the user exits,output the number of problems correct, the number of problems attempted, and the percentage of problems correct to 2 decimal places.

Use a while loop to repeat the menu display/get user choice action.

Use while loop for validation of the upper bound.

Use for loop to repeat the display problem/get answer/check answer steps

Do not use functions.

For random numbers, use

(int)(lowerBound + Math.random() * (upperBound lowerBound + 1))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

5. Recognize your ability to repair and let go of painful conflict

Answered: 1 week ago