Trinh Tong 6 anni fa
parent
commit
54331f2395
3 ha cambiato i file con 26 aggiunte e 21 eliminazioni
  1. 6
    1
      MainApplication.java
  2. 10
    10
      MemoryFunc.java
  3. 10
    10
      package.bluej

+ 6
- 1
MainApplication.java Vedi File

@@ -12,10 +12,15 @@ public class MainApplication {
12 12
         MemoryFunc memory = new MemoryFunc();
13 13
         SwitchDisplay baseChange = new SwitchDisplay();
14 14
         
15
+        // Stored memory value should be able to be used throughout whole application
16
+        Double memoryValue = memory.memory;
17
+        
18
+        // if any input = "m", that input now = the memory value
19
+        
15 20
         // Menu Input
16 21
         String menuInput = " ";
17 22
         // Giant while loop that links back to main menu
18
-        while (!menuInput.equals(4)) {
23
+        while (!menuInput.equals("4")) {
19 24
             mainMenu.mainMenuDisplay();
20 25
             menuInput = Console.getStringInput("Enter the calculator you want to use by key. (ie. 1 for basic, etc.)");
21 26
            

+ 10
- 10
MemoryFunc.java Vedi File

@@ -3,7 +3,7 @@
3 3
 
4 4
  */
5 5
 public class MemoryFunc {
6
-    private Double memory;
6
+    public Double memory;
7 7
     public static final Double DEFAULT_MEMORY_VALUE = new Double(0);
8 8
 
9 9
     public MemoryFunc() {
@@ -19,29 +19,29 @@ public class MemoryFunc {
19 19
     public void memoryMenu() {
20 20
         
21 21
         Console.println("Memory Menu"
22
-                         + "\nM+: Update stored memory value"
23
-                         + "\nMC: Clear to default memory value"
24
-                         + "\nMCR: Display stored memory value"
25
-                         + "\nCancel: Returns to Main Menu");
22
+                         + "\n1: M+ - Update stored memory value"
23
+                         + "\n2: nMC - Clear to default memory value"
24
+                         + "\n3: nMCR - Display stored memory value"
25
+                         + "\n4: Cancel - Returns to Main Menu");
26 26
                          
27 27
         String memoryOpt = "";
28 28
         
29
-        while (!memoryOpt.equals("cancel")) {
29
+        while (!memoryOpt.equals("4")) {
30 30
             
31
-            memoryOpt = Console.getStringInput("Select option by typing the key").toLowerCase();
31
+            memoryOpt = Console.getStringInput("Select option by typing the key. (ie 1 for M+)").toLowerCase();
32 32
             
33
-            if (memoryOpt.equals("m+")) {
33
+            if (memoryOpt.equals("1")) {
34 34
                 
35 35
                 Double newMemory = Console.getDoubleInput("Enter the value to store");
36 36
                 updateMemory(newMemory);
37 37
                 break;
38 38
                 
39
-            } else if (memoryOpt.equals("mc")) {
39
+            } else if (memoryOpt.equals("2")) {
40 40
                 
41 41
                 clearMemory();
42 42
                 break;
43 43
                 
44
-            } else if (memoryOpt.equals("mcr")) {
44
+            } else if (memoryOpt.equals("3")) {
45 45
                 
46 46
                 displayMemory();
47 47
                 break;

+ 10
- 10
package.bluej Vedi File

@@ -1,29 +1,29 @@
1 1
 #BlueJ package file
2
-dependency1.from=MemoryFunc
2
+dependency1.from=MainMenu
3 3
 dependency1.to=Console
4 4
 dependency1.type=UsesDependency
5
-dependency2.from=MainMenu
5
+dependency2.from=SwitchDisplay
6 6
 dependency2.to=Console
7 7
 dependency2.type=UsesDependency
8
-dependency3.from=SwitchDisplay
8
+dependency3.from=SciCalc
9 9
 dependency3.to=Console
10 10
 dependency3.type=UsesDependency
11
-dependency4.from=SciCalc
12
-dependency4.to=Console
11
+dependency4.from=MainApplication
12
+dependency4.to=MainMenu
13 13
 dependency4.type=UsesDependency
14 14
 dependency5.from=MainApplication
15
-dependency5.to=MainMenu
15
+dependency5.to=SciCalc
16 16
 dependency5.type=UsesDependency
17 17
 dependency6.from=MainApplication
18
-dependency6.to=SciCalc
18
+dependency6.to=MemoryFunc
19 19
 dependency6.type=UsesDependency
20 20
 dependency7.from=MainApplication
21
-dependency7.to=MemoryFunc
21
+dependency7.to=SwitchDisplay
22 22
 dependency7.type=UsesDependency
23 23
 dependency8.from=MainApplication
24
-dependency8.to=SwitchDisplay
24
+dependency8.to=Console
25 25
 dependency8.type=UsesDependency
26
-dependency9.from=MainApplication
26
+dependency9.from=MemoryFunc
27 27
 dependency9.to=Console
28 28
 dependency9.type=UsesDependency
29 29
 editor.fx.0.height=722