|
@@ -9,9 +9,15 @@ public class MainApplication {
|
9
|
9
|
CoreFeatures switchCoreFeatures = new CoreFeatures();
|
10
|
10
|
|
11
|
11
|
//User instructions
|
12
|
|
- String userInput = Console.getStringInput("Choose a symbol for the corresponding function : " + "\n"
|
13
|
|
- + " |'+' = addition|" + "\n"+
|
14
|
|
- "|'-' = subtraction|");
|
|
12
|
+ String userInput = Console.getStringInput("Choose a symbol for the corresponding function: " + "\n"+
|
|
13
|
+ "'+' = addition \n"+
|
|
14
|
+ "'-' = subtraction \n" +
|
|
15
|
+ "'*' = multiplication \n" +
|
|
16
|
+ "'/' = division \n" +
|
|
17
|
+ "'^' = square \n" +
|
|
18
|
+ "'^/' = square root \n" +
|
|
19
|
+ "'-/' = invert sign \n" +
|
|
20
|
+ "'off' = turns calculator off \n\n");
|
15
|
21
|
|
16
|
22
|
switch(userInput){
|
17
|
23
|
case "+":
|
|
@@ -32,6 +38,30 @@ public class MainApplication {
|
32
|
38
|
System.out.println(Console.result);
|
33
|
39
|
break;
|
34
|
40
|
|
|
41
|
+ case "/":
|
|
42
|
+ double userInput5 = Console.getDoubleInput("Enter number to be multiplied. ");
|
|
43
|
+ Console.result = switchCoreFeatures.multiplyNumbers(Console.result, userInput5);
|
|
44
|
+ System.out.println(Console.result);
|
|
45
|
+ break;
|
|
46
|
+
|
|
47
|
+ case "^":
|
|
48
|
+ double userInput6 = Console.getDoubleInput("Enter number to be squared. ");
|
|
49
|
+ Console.result = switchCoreFeatures.squareNumber(userInput6);
|
|
50
|
+ System.out.println(Console.result);
|
|
51
|
+ break;
|
|
52
|
+
|
|
53
|
+ case "^/":
|
|
54
|
+ double userInput7 = Console.getDoubleInput("Enter number to be squared rooted. ");
|
|
55
|
+ Console.result = switchCoreFeatures.squareRoot(userInput7);
|
|
56
|
+ System.out.println(Console.result);
|
|
57
|
+ break;
|
|
58
|
+
|
|
59
|
+ case "-/":
|
|
60
|
+ double userInput8 = Console.getDoubleInput("Enter number to be inverted. ");
|
|
61
|
+ Console.result = switchCoreFeatures.invertSign(userInput8);
|
|
62
|
+ System.out.println(Console.result);
|
|
63
|
+ break;
|
|
64
|
+
|
35
|
65
|
case "off":
|
36
|
66
|
Console.calcRunning = false;
|
37
|
67
|
break;
|