Pārlūkot izejas kodu

updating memory functions

Trinh Tong 6 gadus atpakaļ
vecāks
revīzija
084e369965
3 mainītis faili ar 8 papildinājumiem un 6 dzēšanām
  1. 2
    2
      Console.java
  2. 5
    3
      MemoryFunc.java
  3. 1
    1
      SwitchDisplay.java

+ 2
- 2
Console.java Parādīt failu

@@ -21,7 +21,7 @@ public class Console {
21 21
 
22 22
         // Ask if you want to use memory, KEEP TRACK OF MEMORY USE
23 23
         // by boolean
24
-        boolean memoryChanged = memory.memoryChanged;
24
+        Boolean memoryChanged = memory.memoryChanged;
25 25
 
26 26
         // we use 1 input variable statement to call the user to input, then manipulate
27 27
         // Can user input M if native type is double
@@ -44,7 +44,7 @@ public class Console {
44 44
                        
45 45
                 String basicMode = Console.getStringInput("Enter the mode: ");
46 46
                 
47
-                if (memoryChanged != true) {
47
+                if (memory.memoryChanged != true) {
48 48
                     basicInput1 = Console.getDoubleInput("Enter the first input: ");
49 49
                     basicInput2 = Console.getDoubleInput("Enter the second input: ");
50 50
                 } else if (memoryChanged == true) {

+ 5
- 3
MemoryFunc.java Parādīt failu

@@ -4,12 +4,14 @@
4 4
  */
5 5
 public class MemoryFunc {
6 6
     public Double memory;
7
-    public boolean memoryChanged;
7
+    public Boolean memoryChanged;
8 8
     public static final Double DEFAULT_MEMORY_VALUE = new Double(0);
9 9
 
10 10
     public MemoryFunc() {
11 11
         this.memory = DEFAULT_MEMORY_VALUE;
12
+        this.memoryChanged = false;
12 13
     }
14
+    
13 15
     /**
14 16
      * Menu
15 17
      * Clear
@@ -21,8 +23,8 @@ public class MemoryFunc {
21 23
         
22 24
         Console.println("Memory Menu"
23 25
                          + "\n1: M+ - Update stored memory value"
24
-                         + "\n2: nMC - Clear to default memory value"
25
-                         + "\n3: nMCR - Display stored memory value"
26
+                         + "\n2: MC - Clear to default memory value"
27
+                         + "\n3: MCR - Display stored memory value"
26 28
                          + "\n4: Cancel - Returns to Main Menu");
27 29
                          
28 30
         String memoryOpt = "";

+ 1
- 1
SwitchDisplay.java Parādīt failu

@@ -56,7 +56,7 @@ public class SwitchDisplay
56 56
                 return toHexa(baseInput);
57 57
                 
58 58
             case "5":
59
-                return mode;
59
+                break;
60 60
                 
61 61
             default:
62 62
                 return "Invalid Input";