|
@@ -1,4 +1,5 @@
|
1
|
1
|
import java.util.*;
|
|
2
|
+import java.lang.*;
|
2
|
3
|
/**
|
3
|
4
|
* Write a description of class Calculator here.
|
4
|
5
|
*
|
|
@@ -70,15 +71,63 @@ public class MathMethods
|
70
|
71
|
}
|
71
|
72
|
|
72
|
73
|
public static String fortuneCookie() {
|
73
|
|
- Random rand = new Random();
|
|
74
|
+ Random rand = new Random();
|
74
|
75
|
String[] wiseWords = new String[] {"You're a hard worker and you will do great on all the labs!",
|
75
|
|
- "Look how much java you learned this week! That's awesome!", "Keep up the good work!" ,
|
76
|
|
- "You're cushing it!", "You're a coding rockstar!",
|
77
|
|
- "Keep coding!"};
|
78
|
|
- int arrIndex = rand.nextInt(6)+1;
|
|
76
|
+ "Look how much java you learned this week! That's awesome!",
|
|
77
|
+ "Keep up the good work!" ,
|
|
78
|
+ "You're cushing it!", "You're a coding rockstar!",
|
|
79
|
+ "Keep coding!"};
|
|
80
|
+ int arrIndex = rand.nextInt(6);
|
79
|
81
|
return wiseWords[arrIndex];
|
80
|
82
|
}
|
81
|
|
-
|
|
83
|
+
|
|
84
|
+ public static String switchDisplayMode(String mode){
|
|
85
|
+ Calculator display = new Calculator();
|
|
86
|
+ //Double d = new Double(display.memory);
|
|
87
|
+ String answer = "";
|
|
88
|
+ switch (mode) {
|
|
89
|
+ case "binary":
|
|
90
|
+ answer = "";
|
|
91
|
+ break;
|
|
92
|
+
|
|
93
|
+ case "octal":
|
|
94
|
+ answer = "";
|
|
95
|
+ break;
|
|
96
|
+
|
|
97
|
+ case "decimal":
|
|
98
|
+ answer = "";
|
|
99
|
+ break;
|
|
100
|
+
|
|
101
|
+ case "hexadecimal":
|
|
102
|
+ answer = Double.toHexString(display.memory);
|
|
103
|
+ break;
|
|
104
|
+
|
|
105
|
+ }
|
|
106
|
+ return answer;
|
|
107
|
+ }
|
|
108
|
+
|
|
109
|
+ // public static double switchDisplayMode(){
|
|
110
|
+ // int i = 4;
|
|
111
|
+ // double answer = 0;
|
|
112
|
+
|
|
113
|
+ // if (i%4 == 0){
|
|
114
|
+ // answer = switchDisplayMode("binary");
|
|
115
|
+ // i++;
|
|
116
|
+ // }
|
|
117
|
+ // else if (i%4 == 1){
|
|
118
|
+ // answer = switchDisplayMode("octal");
|
|
119
|
+ // i++;
|
|
120
|
+ // }
|
|
121
|
+ // else if (i%4 == 2) {
|
|
122
|
+ // answer = switchDisplayMode("hecadecimal");
|
|
123
|
+ // i++;
|
|
124
|
+ // } else {
|
|
125
|
+ // answer = switchDisplayMode("decimal");
|
|
126
|
+ // i++;
|
|
127
|
+ // }
|
|
128
|
+ // return answer;
|
|
129
|
+ // }
|
|
130
|
+
|
82
|
131
|
public static void printAns(String printAnswer){
|
83
|
132
|
System.out.println("ANSWER: " + printAnswer);
|
84
|
133
|
|
|
@@ -87,7 +136,3 @@ public class MathMethods
|
87
|
136
|
}
|
88
|
137
|
|
89
|
138
|
|
90
|
|
-
|
91
|
|
-
|
92
|
|
-
|
93
|
|
-
|