Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class App {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- System.out.println("Enter opperation:");
- String opperation = scan.next();
- System.out.println("Enter first number:");
- double numberOne = scan.nextDouble();
- System.out.println("Enter second number:");
- double numberTwo = scan.nextDouble();
- double sum = 0;
- switch(opperation) {
- case "-":
- sum = numberOne - numberTwo;
- break;
- case "+":
- sum = numberOne + numberTwo;
- break;
- case "/":
- sum = numberOne / numberTwo;
- break;
- case "*":
- sum = numberOne * numberTwo;
- break;
- }
- System.out.println("result:");
- System.out.println(sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement