Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

who can write a calculator program that gets two numbers from the user and then allows them to choose arithmetic operations from a menu to

who can write a calculator program that gets two numbers from the user and

then allows them to choose arithmetic operations from a menu to perform on these numbers.

Pseudocode is also required for this Part, and should appear in your code as comments.

1. Have the user input two real numbers.

2. Use a while-loop/switch statement combination to get and process user-input menu

choices. Repeat until the user chooses to quit. menu prompt should include the

current values and should give the user the following choices, using multiple lines in a

single dialogue box:

a. Add

b. Multiply

c. Exponentiate (i.e., if x and y are the input numbers, calculate xy)

d. Enter new numbers

e. QUIT

For choices a, b, and c you should perform the indicated calculation and output the result.

Refer to the Math class API as needed. the output should include the current values and

the operation performed. All numbers should be output with one digit to the right of the

decimal place.

For choice d, have the user enter two new numbers, which should be used in subsequent

choices/calculations.

Run your program with the following inputs:

first number: 5.8

second number: 2.0

choice #1: f

choice #2: 5

choice #3: c

choice #4: a

choice #5: d, new numbers: 3.0 and 6.95

choice #6: b

choice #7: e

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

More Books

Students also viewed these Databases questions