Browse Source

Merge branch 'master' of mdimarino/ZCW-MacroLabs-OOP-ScientificCalculator into master

trtong 6 years ago
parent
commit
3fa2b863a9
5 changed files with 26 additions and 32 deletions
  1. BIN
      .DS_Store
  2. 3
    1
      Console.java
  3. 5
    2
      RealAdvanced.java
  4. 8
    0
      RealAdvancedTest.java
  5. 10
    29
      package.bluej

BIN
.DS_Store View File


+ 3
- 1
Console.java View File

116
                     advAnswer = advCalc.opposite(advInput1);
116
                     advAnswer = advCalc.opposite(advInput1);
117
                 }else if (mode.equals("5")){
117
                 }else if (mode.equals("5")){
118
                     advAnswer = advCalc.absoluteValue(advInput1);
118
                     advAnswer = advCalc.absoluteValue(advInput1);
119
+                }else if (mode.equals("6")){
120
+                    advAnswer = advCalc.sqrt(advInput1);
119
 
121
 
120
-                }else if (mode.equals("6")) {
122
+                }else if (mode.equals("7")) {
121
                     break;
123
                     break;
122
                 }else{
124
                 }else{
123
                     Console.println("Invalid input");
125
                     Console.println("Invalid input");

+ 5
- 2
RealAdvanced.java View File

19
             "3: 1/x" + "\n"+
19
             "3: 1/x" + "\n"+
20
             "4: Switch Sign of x" + "\n"+
20
             "4: Switch Sign of x" + "\n"+
21
             "5: Absolute Value of x" + "\n"+
21
             "5: Absolute Value of x" + "\n"+
22
-            "6: Return to Main Menu");
22
+            "6: Square Root of x" + "\n"+
23
+            "7: Return to Main Menu");
23
 
24
 
24
     }
25
     }
25
     // method to find x^2
26
     // method to find x^2
42
     public double absoluteValue(double x){
43
     public double absoluteValue(double x){
43
         return Math.abs(x);
44
         return Math.abs(x);
44
     }
45
     }
45
-
46
+public double sqrt(double x){
47
+    return Math.sqrt(x);
48
+}
46
 }
49
 }

+ 8
- 0
RealAdvancedTest.java View File

74
         RealAdvanced realAdva1 = new RealAdvanced();
74
         RealAdvanced realAdva1 = new RealAdvanced();
75
         assertEquals(4.0, realAdva1.absoluteValue(-4), 0.1);
75
         assertEquals(4.0, realAdva1.absoluteValue(-4), 0.1);
76
     }
76
     }
77
+
78
+    @Test
79
+    public void squareRootTest()
80
+    {
81
+        RealAdvanced realAdva1 = new RealAdvanced();
82
+        assertEquals(5.0, realAdva1.sqrt(25), 0.1);
83
+    }
77
 }
84
 }
78
 
85
 
79
 
86
 
80
 
87
 
81
 
88
 
82
 
89
 
90
+

+ 10
- 29
package.bluej View File

3
 dependency1.to=Console
3
 dependency1.to=Console
4
 dependency1.type=UsesDependency
4
 dependency1.type=UsesDependency
5
 dependency10.from=Console
5
 dependency10.from=Console
6
-dependency10.to=MainMenu
6
+dependency10.to=Basic
7
 dependency10.type=UsesDependency
7
 dependency10.type=UsesDependency
8
 dependency11.from=Console
8
 dependency11.from=Console
9
-dependency11.to=Basic
9
+dependency11.to=RealAdvanced
10
 dependency11.type=UsesDependency
10
 dependency11.type=UsesDependency
11
 dependency12.from=Console
11
 dependency12.from=Console
12
-dependency12.to=RealAdvanced
12
+dependency12.to=SciCalc
13
 dependency12.type=UsesDependency
13
 dependency12.type=UsesDependency
14
 dependency13.from=Console
14
 dependency13.from=Console
15
-dependency13.to=SciCalc
15
+dependency13.to=MemoryFunc
16
 dependency13.type=UsesDependency
16
 dependency13.type=UsesDependency
17
 dependency14.from=Console
17
 dependency14.from=Console
18
-dependency14.to=MemoryFunc
18
+dependency14.to=SwitchDisplay
19
 dependency14.type=UsesDependency
19
 dependency14.type=UsesDependency
20
 dependency15.from=Console
20
 dependency15.from=Console
21
-dependency15.to=SwitchDisplay
21
+dependency15.to=Trig
22
 dependency15.type=UsesDependency
22
 dependency15.type=UsesDependency
23
-<<<<<<< HEAD
24
-dependency16.from=BasicTest
25
-dependency16.to=Basic
26
-dependency16.type=UsesDependency
27
-dependency17.from=TrigTest
28
-dependency17.to=Trig
29
-dependency17.type=UsesDependency
30
-dependency2.from=SciCalc
31
-dependency2.to=Console
32
-dependency2.type=UsesDependency
33
-dependency3.from=RealAdvanced
34
-=======
35
-dependency16.from=Console
36
-dependency16.to=Trig
23
+dependency16.from=RealAdvancedTest
24
+dependency16.to=RealAdvanced
37
 dependency16.type=UsesDependency
25
 dependency16.type=UsesDependency
38
 dependency2.from=SciCalc
26
 dependency2.from=SciCalc
39
 dependency2.to=Console
27
 dependency2.to=Console
48
 dependency5.from=Trig
36
 dependency5.from=Trig
49
 dependency5.to=Console
37
 dependency5.to=Console
50
 dependency5.type=UsesDependency
38
 dependency5.type=UsesDependency
51
-<<<<<<< HEAD
52
 dependency6.from=SwitchDisplay
39
 dependency6.from=SwitchDisplay
53
 dependency6.to=Console
40
 dependency6.to=Console
54
 dependency6.type=UsesDependency
41
 dependency6.type=UsesDependency
55
 dependency7.from=MainMenu
42
 dependency7.from=MainMenu
56
-=======
57
-dependency6.from=MainMenu
58
-dependency6.to=Console
59
-dependency6.type=UsesDependency
60
-dependency7.from=MainApplication
61
->>>>>>> 49d5555735b5e26b8076429d9dd1666b4918738c
62
 dependency7.to=Console
43
 dependency7.to=Console
63
 dependency7.type=UsesDependency
44
 dependency7.type=UsesDependency
64
 dependency8.from=MainApplication
45
 dependency8.from=MainApplication
65
 dependency8.to=Console
46
 dependency8.to=Console
66
 dependency8.type=UsesDependency
47
 dependency8.type=UsesDependency
67
-dependency9.from=RealAdvancedTest
68
-dependency9.to=RealAdvanced
48
+dependency9.from=Console
49
+dependency9.to=MainMenu
69
 dependency9.type=UsesDependency
50
 dependency9.type=UsesDependency
70
 editor.fx.0.height=709
51
 editor.fx.0.height=709
71
 editor.fx.0.width=1215
52
 editor.fx.0.width=1215