Pārlūkot izejas kodu

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

trtong 6 gadus atpakaļ
vecāks
revīzija
434b97f838
4 mainītis faili ar 62 papildinājumiem un 37 dzēšanām
  1. 3
    0
      Console.java
  2. 10
    1
      Trig.java
  3. 8
    0
      TrigTest.java
  4. 41
    36
      package.bluej

+ 3
- 0
Console.java Parādīt failu

@@ -256,6 +256,9 @@ public class Console {
256 256
                         trigAnswer = trigMenu.calcArctan(trigInput);
257 257
 
258 258
                     } else if (trigMode.equals("7")) {
259
+                        trigAnswer = trigMenu.calcLog(trigInput);
260
+
261
+                    } else if (trigMode.equals("8")) {
259 262
                         break;
260 263
 
261 264
                     } else {

+ 10
- 1
Trig.java Parādīt failu

@@ -20,7 +20,8 @@ public class Trig
20 20
             + "\n4: arcsin"
21 21
             + "\n5: arccosin"
22 22
             + "\n6: arctan"
23
-            + "\n7: Cancel - returns to Main Menu");   
23
+            + "\n7: log"
24
+            + "\n8: Cancel - returns to Main Menu");   
24 25
 
25 26
         
26 27
     }
@@ -61,6 +62,12 @@ public class Trig
61 62
         return answer;
62 63
     }
63 64
 
65
+    //Log Method
66
+    public double calcLog(double x) {
67
+        answer = Math.log10(x);
68
+        return answer;
69
+    }
70
+    
64 71
     //Converting from Radians to Degrees
65 72
     public double toDegrees(double answer) 
66 73
     {
@@ -69,5 +76,7 @@ public class Trig
69 76
         return answer;
70 77
 
71 78
     }
79
+    
80
+    
72 81
 }
73 82
 

+ 8
- 0
TrigTest.java Parādīt failu

@@ -88,6 +88,13 @@ public class TrigTest
88 88
         Trig trig1 = new Trig();
89 89
         assertEquals(1.04719755, trig1.calcArccos(0.5), 0.1);
90 90
     }
91
+
92
+    @Test
93
+    public void testLog()
94
+    {
95
+        Trig trig1 = new Trig();
96
+        assertEquals(1, trig1.calcLog(10), 0.1);
97
+    }
91 98
 }
92 99
 
93 100
 
@@ -96,3 +103,4 @@ public class TrigTest
96 103
 
97 104
 
98 105
 
106
+

+ 41
- 36
package.bluej Parādīt failu

@@ -3,58 +3,61 @@ 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 21
 dependency15.to=SwitchDisplay
22 22
 dependency15.type=UsesDependency
23
-dependency16.from=Console
24
-dependency16.to=Trig
23
+dependency16.from=Trig
24
+dependency16.to=Console
25 25
 dependency16.type=UsesDependency
26
-dependency17.from=RealAdvancedTest
27
-dependency17.to=RealAdvanced
26
+dependency17.from=SwitchDisplay
27
+dependency17.to=Console
28 28
 dependency17.type=UsesDependency
29
+dependency18.from=MainApplication
30
+dependency18.to=Console
31
+dependency18.type=UsesDependency
29 32
 dependency2.from=TrigTest
30 33
 dependency2.to=Trig
31 34
 dependency2.type=UsesDependency
32 35
 dependency3.from=BasicTest
33 36
 dependency3.to=Basic
34 37
 dependency3.type=UsesDependency
35
-dependency4.from=MainMenu
36
-dependency4.to=Console
38
+dependency4.from=RealAdvancedTest
39
+dependency4.to=RealAdvanced
37 40
 dependency4.type=UsesDependency
38
-dependency5.from=SciCalc
41
+dependency5.from=MainMenu
39 42
 dependency5.to=Console
40 43
 dependency5.type=UsesDependency
41
-dependency6.from=MemoryFunc
44
+dependency6.from=SciCalc
42 45
 dependency6.to=Console
43 46
 dependency6.type=UsesDependency
44
-dependency7.from=Trig
47
+dependency7.from=RealAdvanced
45 48
 dependency7.to=Console
46 49
 dependency7.type=UsesDependency
47
-dependency8.from=SwitchDisplay
50
+dependency8.from=MemoryFunc
48 51
 dependency8.to=Console
49 52
 dependency8.type=UsesDependency
50
-dependency9.from=RealAdvanced
51
-dependency9.to=Console
53
+dependency9.from=Console
54
+dependency9.to=MainMenu
52 55
 dependency9.type=UsesDependency
53
-editor.fx.0.height=709
54
-editor.fx.0.width=1215
55
-editor.fx.0.x=60
56
-editor.fx.0.y=24
57
-objectbench.height=198
56
+editor.fx.0.height=0
57
+editor.fx.0.width=0
58
+editor.fx.0.x=0
59
+editor.fx.0.y=0
60
+objectbench.height=214
58 61
 objectbench.width=595
59 62
 package.divider.horizontal=0.6
60 63
 package.divider.vertical=0.685099846390169
@@ -64,7 +67,7 @@ package.editor.x=35
64 67
 package.editor.y=23
65 68
 package.frame.height=709
66 69
 package.frame.width=619
67
-package.numDependencies=17
70
+package.numDependencies=18
68 71
 package.numTargets=12
69 72
 package.showExtends=true
70 73
 package.showUses=true
@@ -74,6 +77,7 @@ readme.name=@README
74 77
 readme.width=47
75 78
 readme.x=10
76 79
 readme.y=10
80
+target1.association=BasicTest
77 81
 target1.height=50
78 82
 target1.name=Basic
79 83
 target1.showInterface=false
@@ -81,6 +85,7 @@ target1.type=ClassTarget
81 85
 target1.width=80
82 86
 target1.x=320
83 87
 target1.y=180
88
+target10.association=TrigTest
84 89
 target10.height=50
85 90
 target10.name=Trig
86 91
 target10.showInterface=false
@@ -107,15 +112,15 @@ target2.name=TrigTest
107 112
 target2.showInterface=false
108 113
 target2.type=UnitTestTargetJunit4
109 114
 target2.width=80
110
-target2.x=200
111
-target2.y=70
115
+target2.x=350
116
+target2.y=40
112 117
 target3.height=50
113 118
 target3.name=BasicTest
114 119
 target3.showInterface=false
115 120
 target3.type=UnitTestTargetJunit4
116
-target3.width=90
117
-target3.x=160
118
-target3.y=130
121
+target3.width=80
122
+target3.x=350
123
+target3.y=150
119 124
 target4.height=50
120 125
 target4.name=RealAdvancedTest
121 126
 target4.showInterface=false
@@ -145,16 +150,16 @@ target7.width=110
145 150
 target7.x=170
146 151
 target7.y=10
147 152
 target8.height=50
148
-target8.name=Console
153
+target8.name=MemoryFunc
149 154
 target8.showInterface=false
150 155
 target8.type=ClassTarget
151
-target8.width=80
152
-target8.x=70
153
-target8.y=170
156
+target8.width=110
157
+target8.x=210
158
+target8.y=350
154 159
 target9.height=50
155
-target9.name=MemoryFunc
160
+target9.name=Console
156 161
 target9.showInterface=false
157 162
 target9.type=ClassTarget
158
-target9.width=110
159
-target9.x=210
160
-target9.y=350
163
+target9.width=80
164
+target9.x=70
165
+target9.y=170