forked from 20ayan/Hacktoberfest22
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab9q6.java
More file actions
61 lines (48 loc) · 1.28 KB
/
Lab9q6.java
File metadata and controls
61 lines (48 loc) · 1.28 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
import java.util.*;
import My_Pack.addition;
import My_Pack.subtraction;
import My_Pack.multiplication;
import My_Pack.division;
import My_Pack.cube;
class Lab9q6{
public static void main(String args[]){
double a,b;
char c;
Scanner sc=new Scanner(System.in);
addition a=new Scanner addition();
subtraction s=new subtraction ();
multiplication m=new multiplication ();
division d=new division ();
cube cb=new cube ();
System.out.println("Enter the operator : + - * / ^");
c = sc.next().charAt(0);
System.out.println("Enter the numbers : ");
switch(c){
case '+' :
a = sc.nextDouble();
b = sc.nextDouble();
System.out.println("Addition : "+a.sum(a,b));
break;
case '-' :
a = sc.nextDouble();
b = sc.nextDouble();
System.out.println("Subtraction : "+s.subtract(a,b));
break;
case '*' :
a = sc.nextDouble();
b = sc.nextDouble();
System.out.println("Multiplication : "+m.multiply(a,b));
break;
case '/' :
a = sc.nextDouble();
b = sc.nextDouble();
System.out.println("Division : "+d.divide(a,b));
break;
case '^' :
a = sc.nextDouble();
b = sc.nextDouble();
System.out.println("Cube : "+cb.cube(a));
break;
}
}
}