-
Notifications
You must be signed in to change notification settings - Fork 0
/
Calculate.java
48 lines (36 loc) · 1.01 KB
/
Calculate.java
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
package Calculator;
public class Calculate{
double num1;
double num2;
double result;
public Calculate(){
num1 = 0;
num2 = 0;
result = 0;
}
public double add(double num1, double num2){
return result = num1 + num2;
}
public double subtract(double num1, double num2){
return result = num1 - num2;
}
public double multiply(double num1, double num2){
return result = num1 * num2;
}
public float divide(double num1, double num2){
result = num1 / num2;
return (float)result;
}
public double squareRoot(double num1){
return result = StrictMath.sqrt(num1);
}
public double modulo(double num1, double num2){
return result = num1 % num2;
}
public double exponential(double num1, double num2){
return result = StrictMath.pow(num1, num2);
}
public double percent(double num1){
return result = (num1 / 100);
}
}