|
@@ -8,73 +8,73 @@
|
8
|
8
|
import java.util.*;
|
9
|
9
|
public class simpleOp
|
10
|
10
|
{
|
11
|
|
- public static int currentNumber = 0;
|
|
11
|
+ public static double currentNumber = 0;
|
12
|
12
|
|
13
|
|
- public static int add(int x, int y){
|
|
13
|
+ public static double add(double x, double y){
|
14
|
14
|
//CALULATES THE SUM OF TWO NUMBERS
|
15
|
15
|
currentNumber = x + y;
|
16
|
|
- System.out.println(currentNumber);
|
|
16
|
+ //System.out.println(currentNumber);
|
17
|
17
|
return currentNumber;
|
18
|
18
|
}
|
19
|
19
|
|
20
|
|
- public static int sub(int x, int y){
|
|
20
|
+ public static double sub(double x, double y){
|
21
|
21
|
//CALULATES THE DIFFERENCE OF TWO NUMBERS
|
22
|
|
- int currentNumber = x - y;
|
23
|
|
- System.out.println(x + " - " + y + " = " + currentNumber);
|
|
22
|
+ currentNumber = x - y;
|
|
23
|
+ //System.out.println(currentNumber);
|
24
|
24
|
return currentNumber;
|
25
|
25
|
}
|
26
|
26
|
|
27
|
|
- public static int mul(int x, int y){
|
|
27
|
+ public static double mul(double x, double y){
|
28
|
28
|
//CALULATES THE PRODUCT OF TWO NUMBERS
|
29
|
|
- int currentNumber = x * y;
|
30
|
|
- System.out.println(x + " * " + y + " = " + currentNumber);
|
|
29
|
+ currentNumber = x * y;
|
|
30
|
+ //System.out.println(currentNumber);
|
31
|
31
|
return currentNumber;
|
32
|
32
|
}
|
33
|
33
|
|
34
|
|
- public static int div(int x, int y){
|
|
34
|
+ public static double div(double x, double y){
|
35
|
35
|
//CALULATES THE QUOTIENT OF TWO NUMBERS
|
36
|
|
- int currentNumber = x / y;
|
37
|
|
- System.out.println(x + " / " + y + " = " + currentNumber);
|
|
36
|
+ currentNumber = x / y;
|
|
37
|
+ //System.out.println(currentNumber);
|
38
|
38
|
return currentNumber;
|
39
|
39
|
}
|
40
|
40
|
|
41
|
|
- public static int squ(int x){
|
|
41
|
+ public static double squ(double x){
|
42
|
42
|
//CALULATES THE SQUARE OF ONE NUMBER
|
43
|
|
- //CASTED TO INT FOR NOW... IT'S IN ALPHA, YOU DIG?
|
44
|
|
- int currentNumber = (int) Math.pow(x,2);
|
45
|
|
- System.out.println(x + "\u00B2 = " + currentNumber);
|
|
43
|
+ //CASTED TO double FOR NOW... IT'S IN ALPHA, YOU DIG?
|
|
44
|
+ currentNumber = (int) Math.pow(x,2);
|
|
45
|
+ //System.out.println(currentNumber);
|
46
|
46
|
return currentNumber;
|
47
|
47
|
}
|
48
|
48
|
|
49
|
|
- public static int sqrt(int x){
|
|
49
|
+ public static double sqrt(double x){
|
50
|
50
|
//CALULATES THE SQUARE ROOT OF ONE NUMBER
|
51
|
|
- //CASTED TO INT FOR NOW... IT'S IN ALPHA, YOU DIG?
|
52
|
|
- int currentNumber = (int) Math.sqrt(x);
|
53
|
|
- System.out.println("√" + x + " = " + currentNumber);
|
|
51
|
+ //CASTED TO double FOR NOW... IT'S IN ALPHA, YOU DIG?
|
|
52
|
+ currentNumber = (int) Math.sqrt(x);
|
|
53
|
+ //System.out.println(currentNumber);
|
54
|
54
|
return currentNumber;
|
55
|
55
|
}
|
56
|
56
|
|
57
|
|
- public static int exp(int x, int y){
|
|
57
|
+ public static double exp(double x, double y){
|
58
|
58
|
//CALULATES EXPONENTIATION OF X TO POWER OF Y
|
59
|
|
- //CASTED TO INT FOR NOW... IT'S IN ALPHA, YOU DIG?
|
60
|
|
- int currentNumber = (int) Math.pow(x,y);
|
61
|
|
- System.out.println(x + "^" + y + " = " + currentNumber);
|
|
59
|
+ //CASTED TO double FOR NOW... IT'S IN ALPHA, YOU DIG?
|
|
60
|
+ currentNumber = (int) Math.pow(x,y);
|
|
61
|
+ //System.out.println(currentNumber);
|
62
|
62
|
return currentNumber;
|
63
|
63
|
}
|
64
|
64
|
|
65
|
65
|
public static double inv(double x){
|
66
|
66
|
//CALULATES THE INVERSE OF NUMBER
|
67
|
|
- //CASTED TO INT FOR NOW... IT'S IN ALPHA, YOU DIG?
|
68
|
|
- double currentNumber = 1 / x;
|
69
|
|
- System.out.println("1 / " + x + " = " + currentNumber);
|
|
67
|
+ //CASTED TO double FOR NOW... IT'S IN ALPHA, YOU DIG?
|
|
68
|
+ currentNumber = (1/x);
|
|
69
|
+ //System.out.println(currentNumber);
|
70
|
70
|
return currentNumber;
|
71
|
71
|
}
|
72
|
72
|
|
73
|
|
- public static int invert(int number){
|
|
73
|
+ public static double invert(double x){
|
74
|
74
|
//TURNS NEGATIVE TO POSITIVE OR POSITIVE TO NEGATIVE
|
75
|
|
- currentNumber = -number;
|
76
|
|
- System.out.println(currentNumber);
|
77
|
|
- return currentNumber;
|
|
75
|
+ currentNumber = -x;
|
|
76
|
+ //System.out.println(currentNumber);
|
|
77
|
+ return currentNumber;
|
78
|
78
|
}
|
79
|
79
|
|
80
|
80
|
}
|