MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / main

Method main

Programs/Calculator.java:20–48  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

18
19public class s1 {
20 public static void main(String[] args) {
21 Scanner sc = new Scanner(System.in);
22 System.out.println("Enter First Number: ");
23 double a = sc.nextDouble();
24
25 System.out.println("Enter Second Number: ");
26 double b = sc.nextDouble();
27
28 System.out.print("choose one: \n 1. For Addition\n 2. For Substraction\n 3. For Multiplication\n 4. For Division\n 5. For Modulation \n : ");
29 int n = sc.nextInt();
30
31 switch (n) {
32 case 1:
33 System.out.println("Addition: "+(a+b));
34 break;
35 case 2:
36 System.out.println("Substraction: "+(a-b));
37 break;
38 case 3:
39 System.out.println("Multiplication: "+(a*b));
40 break;
41 case 4:
42 System.out.println("Division: "+(a/b));
43 break;
44 default:
45 System.out.println("Plz Choose Right Option");
46 break;
47 }
48 }
49}
50
51

Callers

nothing calls this directly

Calls 1

printMethod · 0.80

Tested by

no test coverage detected