Question: write a java program 3. Create the equivalent of a four -function calculator. The program should request the user to enter a number, an operator,
3. Create the equivalent of a four -function calculator. The program should request the user to enter a number, an operator, and another number (Use floating-point numbers). It should then carry out the specific arithmetic operation: addition, subtraction, multiplication or division of two numbers. As you know, division by zero is not defined. So program must display an error message if division by zero occurs. You may use a switch statement to select the operation. Finally display the result. When it finishes the calculation, the program should ask if the user wants to do another calculation. The answer can be y' or n' (may use uppercase y or n also). The following output shows the results of two operations Enter first number: 15 Enter an operator: / Enter second number: 2 15/2-7.50 Do another (Enter y or Y for yes or n or N for no)? y Enter first number: 12 Enter an operator: + Enter second number: 125 12 125 137 Do another (Enter y or Y for yes or n or N for no)? n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
