Question: in java Write a program to simulate a simple calculator with the following functions: . addition (1 + 2 is 3) subtraction (12 - 4

Write a program to simulate a simple calculator with the following functions: . addition (1 + 2 is 3) subtraction (12 - 4 is 8) multiplication (33 * 2 is 66) division (3/8 is 0.375) exponents (2^3 is 8) error messages when you do something wrong Here are the requirements for the program: -You should be displaying the options using a menu (1 for addition, 2 for subtraction, 3 for multiplication, 4 for division and 5 to quit). - You should also be using a while loop to keep the program running until the user choses to quit ( when the user enters 5). - The computations should be done using decimal numbers ( double or float data types). -Display an error message when the input is invalid. - Use Math.pow( base, exponent ) for the exponent which returns the base to the exponent power, that is, base pent(e.g. Math.pow(2, 3) will retum 8) Please enter the operation you wish to perform 2. Subtraction 3. Multiplication 5- Exponent Your choice: 7 Invalid Input! 1 - Addition 4. Division 6. Quit Please enter the operation you wish to perform 1. Addition 2. Subtraction 3. Multiplication 4. Division 5. Exponent 6. Quit Your choice: 4 Enter first operand: 100.75 Enter second operand: 25.25 100.75/25.28 3.9900990099009 Please enter the operation you wish to perform 1. Addition 2- Subtraction 3. Multiplication 4- Division 5. Exponent 6- Quit Your choice: 6 Thank you for using the Calculator! Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
