Write a program to simulate a menu driven calculator that performs basic arithmetic operations (add, subtract, multiply
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a program to simulate a menu driven calculator that performs basic arithmetic operations (add, subtract, multiply and divide). The calculator accepts two numbers and an operator from the user in a given format:
For example:
Input: 6.3 / 3
Output: 2.1
Create a Calculator class that has a method to choose the right mathematical operation based on the entered operator using switch case. It should then call a corresponding method to perform the operation.
In the main method of the testing class create an object of Calculator and accept user's input using the Scanner object. The user should be offered a choice to continue with the next operation.
Related Book For
Modern Mathematical Statistics With Applications
ISBN: 9783030551551
3rd Edition
Authors: Jay L. Devore, Kenneth N. Berk, Matthew A. Carlton
Posted Date: