Преглед на файлове

updating memory functions

Trinh Tong преди 6 години
родител
ревизия
084e369965
променени са 3 файла, в които са добавени 8 реда и са изтрити 6 реда
  1. 2
    2
      Console.java
  2. 5
    3
      MemoryFunc.java
  3. 1
    1
      SwitchDisplay.java

+ 2
- 2
Console.java Целия файл

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

+ 5
- 3
MemoryFunc.java Целия файл

4
  */
4
  */
5
 public class MemoryFunc {
5
 public class MemoryFunc {
6
     public Double memory;
6
     public Double memory;
7
-    public boolean memoryChanged;
7
+    public Boolean memoryChanged;
8
     public static final Double DEFAULT_MEMORY_VALUE = new Double(0);
8
     public static final Double DEFAULT_MEMORY_VALUE = new Double(0);
9
 
9
 
10
     public MemoryFunc() {
10
     public MemoryFunc() {
11
         this.memory = DEFAULT_MEMORY_VALUE;
11
         this.memory = DEFAULT_MEMORY_VALUE;
12
+        this.memoryChanged = false;
12
     }
13
     }
14
+    
13
     /**
15
     /**
14
      * Menu
16
      * Menu
15
      * Clear
17
      * Clear
21
         
23
         
22
         Console.println("Memory Menu"
24
         Console.println("Memory Menu"
23
                          + "\n1: M+ - Update stored memory value"
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
                          + "\n4: Cancel - Returns to Main Menu");
28
                          + "\n4: Cancel - Returns to Main Menu");
27
                          
29
                          
28
         String memoryOpt = "";
30
         String memoryOpt = "";

+ 1
- 1
SwitchDisplay.java Целия файл

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