|
@@ -15,12 +15,43 @@ public class MemoryFunc {
|
15
|
15
|
* Print
|
16
|
16
|
* Update
|
17
|
17
|
*/
|
|
18
|
+
|
18
|
19
|
public void memoryMenu() {
|
|
20
|
+
|
19
|
21
|
Console.println("Memory Menu"
|
20
|
22
|
+ "\nM+: Update stored memory value"
|
21
|
23
|
+ "\nMC: Clear to default memory value"
|
22
|
|
- + "\nMCR: Display stored memory value" );
|
|
24
|
+ + "\nMCR: Display stored memory value"
|
|
25
|
+ + "\nCancel: Returns to Main Menu");
|
23
|
26
|
|
|
27
|
+ String memoryOpt = "";
|
|
28
|
+
|
|
29
|
+ while (!memoryOpt.equals("cancel")) {
|
|
30
|
+
|
|
31
|
+ memoryOpt = Console.getStringInput("Select option by typing the key").toLowerCase();
|
|
32
|
+
|
|
33
|
+ if (memoryOpt.equals("m+")) {
|
|
34
|
+
|
|
35
|
+ Double newMemory = Console.getDoubleInput("Enter the value to store");
|
|
36
|
+ updateMemory(newMemory);
|
|
37
|
+ break;
|
|
38
|
+
|
|
39
|
+ } else if (memoryOpt.equals("mc")) {
|
|
40
|
+
|
|
41
|
+ clearMemory();
|
|
42
|
+ break;
|
|
43
|
+
|
|
44
|
+ } else if (memoryOpt.equals("mcr")) {
|
|
45
|
+
|
|
46
|
+ displayMemory();
|
|
47
|
+ break;
|
|
48
|
+
|
|
49
|
+ } else {
|
|
50
|
+
|
|
51
|
+ Console.println("Invalid Option");
|
|
52
|
+
|
|
53
|
+ }
|
|
54
|
+ }
|
24
|
55
|
}
|
25
|
56
|
|
26
|
57
|
public void updateMemory(Double memoryInput) {
|