Implement a simple, four function calculator. Your programshould prompt the user to select one of the following
Question:
Implement a simple, four function calculator. Your programshould prompt the user to select one of the following operations:?a? or ?A? for addition; ?s? or ?S? for subtraction; ?m? or ?M? formultiplication; ?d? or ?D? for division; or ?q? or ?Q? to quit.Next, the user should be prompted to enter two double values. Theprogram should then print out the result of the calculation andprompt the user again to select an available function.
Some test cases to consider: (a) If the user enters a value thatis not one of the calculators functions, the program should tellthe user the input is not recognized; (b) The program shouldrecognize both lowercase and uppercase input.1) Create a new classnamed ?Calculator?.2) Modify your code using the followingsample:
import java.util.Scanner;
public class Calculator{
public static void main(String [] args){
}
public static void add(double x, double y){
}
public static void subtract(double x, doubley) {
}
public static void multiply(double x, doubley) {
}
public static void divide(double x, doubley) {
}
}
3) Implement the four Java methods ?add?, ?subtract?,?multiply?, and ?divide? to print the first operand, the mathsymbol for the operation, the second operand, an equal sign, andthen the result.
4) Implement the ?main? method to accept a user?s input andinvoke the appropriate method to complete the calculation.
5) Test your implementation and verify your output. See theexample outputs from test runs of the program: