|
@@ -89,31 +89,31 @@ class Calculator{
|
89
|
89
|
memory = result;
|
90
|
90
|
calc.printAns(String.valueOf(result));
|
91
|
91
|
break;
|
92
|
|
-
|
|
92
|
+
|
93
|
93
|
case "invert":
|
94
|
94
|
result = calc.invert(num1);
|
95
|
95
|
memory = result;
|
96
|
96
|
calc.printAns(String.valueOf(result));
|
97
|
97
|
break;
|
98
|
|
-
|
|
98
|
+
|
99
|
99
|
case "sine":
|
100
|
100
|
result = calc.sin(num1);
|
101
|
101
|
memory = result;
|
102
|
102
|
calc.printAns(String.valueOf(result));
|
103
|
103
|
break;
|
104
|
|
-
|
|
104
|
+
|
105
|
105
|
case "inverse sine":
|
106
|
106
|
result = calc.iSin(num1);
|
107
|
107
|
memory = result;
|
108
|
108
|
calc.printAns(String.valueOf(result));
|
109
|
109
|
break;
|
110
|
|
-
|
|
110
|
+
|
111
|
111
|
case "degree to radian":
|
112
|
112
|
result = calc.degToRad(num1);
|
113
|
113
|
memory = result;
|
114
|
114
|
calc.printAns(String.valueOf(result));
|
115
|
115
|
break;
|
116
|
|
-
|
|
116
|
+
|
117
|
117
|
case "radian to degree":
|
118
|
118
|
result = calc.radToDeg(num1);
|
119
|
119
|
memory = result;
|
|
@@ -125,96 +125,3 @@ class Calculator{
|
125
|
125
|
}
|
126
|
126
|
}
|
127
|
127
|
}
|
128
|
|
- // /**
|
129
|
|
- // * Created by leon on 2/9/18.
|
130
|
|
- // */
|
131
|
|
- // public class Console {
|
132
|
|
- // Calculator calc = new Calculator();
|
133
|
|
-
|
134
|
|
- // public static void print(String output, Object... args) {
|
135
|
|
- // System.out.printf(output, args);
|
136
|
|
- // }
|
137
|
|
-
|
138
|
|
- // public static void println(String output, Object... args) {
|
139
|
|
- // print(output + "\n", args);
|
140
|
|
- // }
|
141
|
|
-
|
142
|
|
- // public static String getMethod() {
|
143
|
|
- // Scanner scanner = new Scanner(System.in);
|
144
|
|
- // String userInput = scanner.nextLine();
|
145
|
|
- // return userInput;
|
146
|
|
- // }
|
147
|
|
-
|
148
|
|
- // public static String switchStatment() {
|
149
|
|
- // Scanner scanner = new Scanner(System.in);
|
150
|
|
- // String ultimateAnswer = "";
|
151
|
|
- // Boolean turnOff = false;
|
152
|
|
-
|
153
|
|
- // switch (getMethod()) {
|
154
|
|
- // case "add" :
|
155
|
|
- // System.out.println("Enter your numbers:");
|
156
|
|
- // double userInput = scanner.nextDouble();
|
157
|
|
- // double nextInput = scanner.nextDouble();
|
158
|
|
-
|
159
|
|
- // double answer = Calculator.add(userInput, nextInput);
|
160
|
|
- // ultimateAnswer = Double.toString(answer);
|
161
|
|
- // return Double.toString(answer);
|
162
|
|
-
|
163
|
|
- // case "subtract" :
|
164
|
|
- // System.out.println("Enter your numbers:");
|
165
|
|
- // userInput = scanner.nextDouble();
|
166
|
|
- // nextInput = scanner.nextDouble();
|
167
|
|
-
|
168
|
|
- // answer = Calculator.subtract(userInput, nextInput);
|
169
|
|
- // ultimateAnswer = Double.toString(answer);
|
170
|
|
- // return ultimateAnswer;
|
171
|
|
-
|
172
|
|
- // case "multiply" :
|
173
|
|
- // System.out.println("Enter your numbers:");
|
174
|
|
- // userInput = scanner.nextDouble();
|
175
|
|
- // nextInput = scanner.nextDouble();
|
176
|
|
-
|
177
|
|
- // answer = Calculator.multiply(userInput, nextInput);
|
178
|
|
- // ultimateAnswer = Double.toString(answer);
|
179
|
|
- // return ultimateAnswer;
|
180
|
|
-
|
181
|
|
- // case "divide" :
|
182
|
|
- // System.out.println("Enter your numbers:");
|
183
|
|
- // userInput = scanner.nextDouble();
|
184
|
|
- // nextInput = scanner.nextDouble();
|
185
|
|
-
|
186
|
|
- // answer = Calculator.divide(userInput, nextInput);
|
187
|
|
- // ultimateAnswer = Double.toString(answer);
|
188
|
|
- // return ultimateAnswer;
|
189
|
|
-
|
190
|
|
- // case "Square Root" :
|
191
|
|
-
|
192
|
|
-
|
193
|
|
- // }
|
194
|
|
- // return ultimateAnswer;
|
195
|
|
- // }
|
196
|
|
-
|
197
|
|
- // /*public static String getStringInput(String prompt) {
|
198
|
|
- // Scanner scanner = new Scanner(System.in);
|
199
|
|
- // println(prompt);
|
200
|
|
- // String userInput = scanner.nextLine();
|
201
|
|
- // return userInput;
|
202
|
|
- // }
|
203
|
|
-
|
204
|
|
- // public static Integer getIntegerInput(String prompt) {
|
205
|
|
- // Scanner scanner = new Scanner(System.in);
|
206
|
|
- // println(prompt);
|
207
|
|
- // int userInput = scanner.nextInt();
|
208
|
|
- // return null;
|
209
|
|
- // }
|
210
|
|
-
|
211
|
|
- // public static Double getDoubleInput(String prompt) {
|
212
|
|
- // Scanner scanner = new Scanner(System.in);
|
213
|
|
- // println(prompt);
|
214
|
|
- // double userInput = scanner.nextDouble();
|
215
|
|
- // double nextInput = scanner.nextDouble();
|
216
|
|
- // double answer = Calculator.add(userInput, nextInput);
|
217
|
|
- // return answer;
|
218
|
|
- // }*/
|
219
|
|
-
|
220
|
|
- // }
|