0% found this document useful (0 votes)
11 views1 page

Presentation 3

The document shows Java code that takes in two numbers and an operator, performs the operation on the numbers based on the operator, and outputs the result.

Uploaded by

Medina Mesic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

Presentation 3

The document shows Java code that takes in two numbers and an operator, performs the operation on the numbers based on the operator, and outputs the result.

Uploaded by

Medina Mesic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 1

System.out.

println("Enter second number");


number2 = input.nextDouble();

switch (operator) {

// performs addition between numbers


case '+':
result = number1 + number2;
System.out.println(number1 + " + " + number2 + " = " +
result);
break;

// performs subtraction between numbers


case '-':
result = number1 - number2;
System.out.println(number1 + " - " + number2 + " = " +
result);
break;

// performs multiplication between numbers


case '*':
result = number1 * number2;
System.out.println(number1 + " * " + number2 + " = " +
result);

You might also like