-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebCalci.java
More file actions
72 lines (65 loc) · 2.4 KB
/
WebCalci.java
File metadata and controls
72 lines (65 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package webcalci;
import java.util.Scanner;
/**
*
* @author data
*/
public class WebCalci {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a=0,b,c,choice;
System.out.println("Enter the 1st number");
b=sc.nextInt();
System.out.println("Enter the 2nd number");
c=sc.nextInt();
System.out.println("1.Addition");
System.out.println("2.Subtraction");
System.out.println("3.Multiplication");
System.out.println("4.Division");
System.out.println("Enter your choice");
choice=sc.nextInt();
switch(choice){
case 1:a=add(b,c);
System.out.println("The addition of "+b+" and "+c+" is "+a);
break;
case 2:a=sub(b,c);
System.out.println("The subtraction of "+b+" and "+c+" is "+a);
break;
case 3:a=mul(b,c);
System.out.println("The multiplication of "+b+" and "+c+" is "+a);
break;
case 4:a=div(b,c);
System.out.println("The division of "+b+" and "+c+" is "+a);
break;
default:System.out.println("Please enter the correct operation");
}
}
private static int sub(int i, int j) {
arun.CalculatorService_Service service = new arun.CalculatorService_Service();
arun.CalculatorService port = service.getCalculatorServicePort();
return port.sub(i, j);
}
private static int add(int i, int j) {
arun.CalculatorService_Service service = new arun.CalculatorService_Service();
arun.CalculatorService port = service.getCalculatorServicePort();
return port.add(i, j);
}
private static int mul(int i, int j) {
arun.CalculatorService_Service service = new arun.CalculatorService_Service();
arun.CalculatorService port = service.getCalculatorServicePort();
return port.mul(i, j);
}
private static int div(int i, int j) {
arun.CalculatorService_Service service = new arun.CalculatorService_Service();
arun.CalculatorService port = service.getCalculatorServicePort();
return port.div(i, j);
}
}