Computer Science, asked by sarthaktembvalkar, 11 months ago

Create a simple calculator in Java Programming which performs the basic four

mathematical operations i.e., addition, subtraction, multiplication, and division.

Use the switch case/if else to identify the input operator to perform required

calculation and then display the result on the screen.

** Students have to use BlueJ software for the project.​

Answers

Answered by dhairyathebest07
4

Answer:

here it is

Explanation:

class calc

{

public static void main(double n1, double n2,char ch)

{

double ans;

switch(ch)

{

case 1:

ans=n1+n2;

System.out.println("Addition is" + ans);

break;

case 2:

ans=n1-n2;

System.out.println("Subtraction is" + ans);

break;

case 3:

ans=n1*n2;

System.out.println("Multiplication is" + ans);

break;

case 4:

ans=n1/n2;

System.out.println("Division is" + ans);

break;

default:

System.out.println("INVALID CHOICE");

break;

}

}

}

Similar questions