Advertisement
martigpg3

Main

Aug 21st, 2024
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Main
  4. {
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.  
  8.         System.err.println("Type the numbers x");
  9.         double num1 = Double.parseDouble(scanner.nextLine());
  10.        
  11.         System.err.println("Type the numbers y");
  12.         double num2 = Double.parseDouble(scanner.nextLine());
  13.  
  14.         System.err.println("type the function you want to execute (sum,multi,divade,subract)");
  15.         String fucn = scanner.nextLine();
  16.         scanner.close();
  17.        
  18.         Calculator cal = new Calculator();
  19.         double result = cal.calculate(num1, num2, fucn);
  20.  
  21.         System.err.println(result);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement