소스 검색

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

trtong 6 년 전
부모
커밋
3fa2b863a9
5개의 변경된 파일26개의 추가작업 그리고 32개의 파일을 삭제
  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 파일 보기


+ 3
- 1
Console.java 파일 보기

@@ -116,8 +116,10 @@ public class Console {
116 116
                     advAnswer = advCalc.opposite(advInput1);
117 117
                 }else if (mode.equals("5")){
118 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 123
                     break;
122 124
                 }else{
123 125
                     Console.println("Invalid input");

+ 5
- 2
RealAdvanced.java 파일 보기

@@ -19,7 +19,8 @@ public class RealAdvanced
19 19
             "3: 1/x" + "\n"+
20 20
             "4: Switch Sign of x" + "\n"+
21 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 26
     // method to find x^2
@@ -42,5 +43,7 @@ public class RealAdvanced
42 43
     public double absoluteValue(double x){
43 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 파일 보기

@@ -74,9 +74,17 @@ public class RealAdvancedTest
74 74
         RealAdvanced realAdva1 = new RealAdvanced();
75 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 파일 보기

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