Bladeren bron

Updated baseOption methods

Trinh Tong 6 jaren geleden
bovenliggende
commit
6b61ce7a92
1 gewijzigde bestanden met toevoegingen van 33 en 10 verwijderingen
  1. 33
    10
      AdvCalc.java

+ 33
- 10
AdvCalc.java Bestand weergeven

@@ -1,12 +1,12 @@
1
-
1
+    
2 2
 /**
3
- * 4.2 Scientific Calculator Group Project
4
- * Trinh Tong, Lauren Green, Michelle Dimarino
5
- * Advanced Calculator Menu
6
- */
7
-public class AdvCalc
3
+* 4.2 Scientific Calculator Group Project
4
+* Trinh Tong, Lauren Green, Michelle Dimarino
5
+* Advanced Calculator Menu
6
+*/
7
+public class AdvCalc 
8 8
 {
9
-    // instance variables - replace the example below with your own
9
+
10 10
     private double memory = 0;
11 11
 
12 12
     /**
@@ -15,13 +15,36 @@ public class AdvCalc
15 15
      * switchDisplayMode() rotates through the options
16 16
      * switchDisplayMode(String mode) sets the display to the mode given
17 17
      */
18
-    public void switchDisplay(int y)
18
+    public void switchDisplay(String mode)
19 19
     {
20
-        // put your code here
20
+        int baseInput = Console.getIntegerInput("Enter an integer to see the base conversions.");
21
+        
22
+        Console.println("Display Options" 
23
+                         + "\nBinary: " + null
24
+                         + "\nOctal: " + null
25
+                         + "\nDecimal: " + null
26
+                         + "\nHexadecimal: " + null
27
+                         + "\n");
28
+        
29
+        mode = Console.getStringInput("Enter the base option to display.");
30
+        if (mode.toLowerCase().equals("binary") == true) {
31
+            
32
+        } else if (mode.toLowerCase().equals("octal") == true) {
33
+            
34
+        }
35
+        
21 36
 
22 37
     }
23 38
     
24 39
     /**
40
+     * Converts the user input into octal and returns a string of that octal.
41
+     */
42
+    public String toOctal(int userInput) {
43
+        
44
+        return Integer.toOctalString(userInput);
45
+        
46
+    }
47
+    /**
25 48
      * Store 1 numeric value in memory for recall later
26 49
      * M+ = add currently displayed value to the value in memorie (default = 0)
27 50
      * MC = reset memory
@@ -65,7 +88,7 @@ public class AdvCalc
65 88
      */
66 89
     public void toTrig(int y)
67 90
     {
68
-        // put your code here
91
+        // calls the trig menu
69 92
         
70 93
     }
71 94
 }