瀏覽代碼

fixed merge conflicts

Lauren Green 6 年之前
父節點
當前提交
084f5e5629
共有 5 個檔案被更改,包括 162 行新增7 行删除
  1. 二進制
      .DS_Store
  2. 58
    0
      Adv.java
  3. 94
    0
      AdvCalc.java
  4. 1
    1
      README.md
  5. 9
    6
      package.bluej

二進制
.DS_Store 查看文件


+ 58
- 0
Adv.java 查看文件

@@ -0,0 +1,58 @@
1
+
2
+/**
3
+* Scientific Calculator Lab
4
+* Advanced Calculator Scientific Menu Options
5
+*/
6
+public class Adv
7
+{
8
+    // instance variables - replace the example below with your own
9
+    private int memory = 0;
10
+ 
11
+    
12
+    /**
13
+    * switch display mode
14
+    * - Binary
15
+    * - Octal
16
+    * - Decimal
17
+    * - Hexadecimal
18
+    */
19
+    public int sampleMethod(int y)
20
+    {
21
+        // Base Mode
22
+        Console.println("Base Mode");
23
+        // Ask for input
24
+        Integer i = Console.getIntegerInput("Enter an integer");
25
+        // Display base options
26
+        // Ask for base option input
27
+        
28
+        return 2;
29
+    }
30
+    
31
+    /**
32
+     * 
33
+    * Memory Mode
34
+    * M+ = add currently displaced value to the value in memory default 0
35
+    * MC = clear memory
36
+    * MCR = display memory
37
+    * 
38
+    */
39
+    public void memory()
40
+    {
41
+        // Memory Mode
42
+        // Ask for input
43
+        // Display memory menu
44
+        // memory option input, if statement
45
+    }
46
+    
47
+    /**
48
+    * switch display mode
49
+    * - Binary
50
+    * - Octal
51
+    * - Decimal
52
+    * - Hexadecimal
53
+    */
54
+    public void toTrig(int y)
55
+    {
56
+        //calls to the trig menu
57
+    }
58
+}

+ 94
- 0
AdvCalc.java 查看文件

@@ -0,0 +1,94 @@
1
+    
2
+/**
3
+* 4.2 Scientific Calculator Group Project
4
+* Trinh Tong, Lauren Green, Michelle Dimarino
5
+* Advanced Calculator Menu
6
+*/
7
+public class AdvCalc 
8
+{
9
+
10
+    private double memory = 0;
11
+
12
+    /**
13
+     * Switch Display Mode method 
14
+     * -> binary, octal, decimal, hexadecimal
15
+     * switchDisplayMode() rotates through the options
16
+     * switchDisplayMode(String mode) sets the display to the mode given
17
+     */
18
+    public void switchDisplay(String mode)
19
+    {
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
+        
36
+
37
+    }
38
+    
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
+    /**
48
+     * Store 1 numeric value in memory for recall later
49
+     * M+ = add currently displayed value to the value in memorie (default = 0)
50
+     * MC = reset memory
51
+     * MRC = recall current valie from memory to display
52
+     */
53
+    public void memory()
54
+    {
55
+        // Memory menu
56
+        Console.println("Memory Mode");
57
+        // Ask for input of a number
58
+        double memoryInput = Console.getDoubleInput("Enter a number to store. ");
59
+        // Display memory keys
60
+        Console.println("Memory Options: " 
61
+                         + "\nM+ : adds input to memory"
62
+                         + "\nMC : clears current memory"
63
+                         + "\nMRC : displays current memory input");
64
+                         
65
+        String memorySelect = Console.getStringInput("What would you like to do? (Enter the key)");
66
+
67
+        
68
+        if (memorySelect.equals("M+") == true) {
69
+            // M+
70
+            memory = memoryInput;
71
+            
72
+        } else if (memorySelect.equals("MC") == true) {
73
+            // MC
74
+            memory = 0;
75
+            
76
+        } else if (memorySelect.equals("MCR") == true) {
77
+            // MCR
78
+            Console.println(Double.toString(memory));
79
+        
80
+        }
81
+        
82
+    }  
83
+    
84
+    
85
+    /**
86
+     * To Trig -
87
+     * sends user to trig functions of the calculator
88
+     */
89
+    public void toTrig(int y)
90
+    {
91
+        // calls the trig menu
92
+        
93
+    }
94
+}

+ 1
- 1
README.md 查看文件

@@ -89,4 +89,4 @@ The following functions should take the displayed value (x) and updated it accor
89 89
 
90 90
 ## Submission
91 91
 
92
-Completed projects should be submitted by submitting a pull request against the [original repository](https://git.zipcode.rocks/ZipCodeWilmington/ZCW-MacroLabs-OOP-ScientificCalculator). All work should be done in your own repository.
92
+Completed projects should be submitted by submitting a pull request against the [original repository](https://git.zipcode.rocks/Cohort4.2/ZCW-MacroLabs-OOP-ScientificCalculator). All work should be done in your own repository.

+ 9
- 6
package.bluej 查看文件

@@ -1,11 +1,14 @@
1 1
 #BlueJ package file
2
-dependency1.from=MainApplication
2
+dependency1.from=AdvCalc
3 3
 dependency1.to=Console
4 4
 dependency1.type=UsesDependency
5
-editor.fx.0.height=722
6
-editor.fx.0.width=800
7
-editor.fx.0.x=801
8
-editor.fx.0.y=23
5
+dependency2.from=MainApplication
6
+dependency2.to=Console
7
+dependency2.type=UsesDependency
8
+editor.fx.0.height=0
9
+editor.fx.0.width=0
10
+editor.fx.0.x=0
11
+editor.fx.0.y=0
9 12
 objectbench.height=214
10 13
 objectbench.width=595
11 14
 package.divider.horizontal=0.6
@@ -16,7 +19,7 @@ package.editor.x=35
16 19
 package.editor.y=60
17 20
 package.frame.height=759
18 21
 package.frame.width=619
19
-package.numDependencies=1
22
+package.numDependencies=2
20 23
 package.numTargets=4
21 24
 package.showExtends=true
22 25
 package.showUses=true