|
@@ -34,6 +34,7 @@ public class Calculator{
|
34
|
34
|
} else {
|
35
|
35
|
switch (toDo) {
|
36
|
36
|
//System.out.println("toDO is: " + toDo);
|
|
37
|
+
|
37
|
38
|
case "add":
|
38
|
39
|
case "subtract":
|
39
|
40
|
case "multiply":
|
|
@@ -51,12 +52,17 @@ public class Calculator{
|
51
|
52
|
case "tangent" :
|
52
|
53
|
case "inverse tangent" :
|
53
|
54
|
case "inverse" :
|
54
|
|
- case "M+" :
|
|
55
|
+
|
55
|
56
|
System.out.println(toDo + " -- Enter first number:");
|
56
|
57
|
num1 = input1.nextDouble();
|
57
|
58
|
//System.out.println("num1 is: " + num1);
|
58
|
59
|
}
|
59
|
60
|
switch (toDo){
|
|
61
|
+ // case "previous":
|
|
62
|
+ // num1 = lastAns;
|
|
63
|
+ // System.out.println(toDo + " -- Enter second number:");
|
|
64
|
+ // num2 = input1.nextDouble();
|
|
65
|
+ //break;
|
60
|
66
|
case "add":
|
61
|
67
|
case "subtract":
|
62
|
68
|
case "multiply":
|
|
@@ -69,6 +75,8 @@ public class Calculator{
|
69
|
75
|
}
|
70
|
76
|
|
71
|
77
|
switch (toDo) {
|
|
78
|
+
|
|
79
|
+
|
72
|
80
|
case "add":
|
73
|
81
|
result = calc.add(num1, num2);
|
74
|
82
|
lastAns = result;
|
|
@@ -206,9 +214,7 @@ public class Calculator{
|
206
|
214
|
break;
|
207
|
215
|
|
208
|
216
|
case "M+" :
|
209
|
|
- System.out.println("Enter number:");
|
210
|
|
- num1 = input1.nextDouble();
|
211
|
|
- result = Memory.memUpdate(num1);
|
|
217
|
+ result = Memory.memUpdate(lastAns);
|
212
|
218
|
Memory.printAns(String.valueOf(result));
|
213
|
219
|
break;
|
214
|
220
|
|