Question: JAVA Basic Calculator Assignment In this assignment, you will create a basic calculator with a minor twist to keep things interesting. The calculator should be

JAVA Basic Calculator Assignment

In this assignment, you will create a basic calculator with a minor twist to keep things interesting. The calculator should be capable of the following operations:

add two numbers

subtract two numbers

multiply two numbers

divide two numbers

generate a random number within a given range.

Be careful to ensure that the user does not try to divide by zero. Here are some example runs of the program:

Menu

1. Add

2. Subtract

3. Multiply

4. Divide

5. Generate Random Number

What would you like to do? 8

I'm sorry, 8 wasn't one of the options

Menu

1. Add

2. Subtract

3. Multiply

4. Divide

5. Generate Random Number

What would you like to do? 4

What is the first number? 3

What is the second number? 8

Answer: 0.375

Menu

1. Add

2. Subtract

3. Multiply

4. Divide

5. Generate Random Number

What would you like to do? 4

What is the first number? 6

What is the second number? 0

I'm sorry, you can't divide by zero.

Menu

1. Add

2. Subtract

3. Multiply

4. Divide

5. Generate Random Number

What would you like to do? 5

What is the lower limit? 10

What is the upper limit? 20

Answer: 15.325396639642719

You will be graded according to the following rubric (each item is worth one point):

A menu is displayed and the user's option is read in

Options less than 1 and greater than 5 are recognized as invalid

For valid options, the required input is requested and read in

The program computes the correct answers for all arithmetic options

Division by zero is recognized and handled

The random number generation option works correctly

Output is displayed to the user

Your program compiles

Your program runs.

You follow standard coding conventions (e.g. variable names, indentation, comments, etc.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!