Procházet zdrojové kódy

merged and working

Demetrius Murray před 6 roky
rodič
revize
d09b271069
5 změnil soubory, kde provedl 61 přidání a 47 odebrání
  1. 4
    13
      Bonus.java
  2. 7
    7
      Console.java
  3. 4
    1
      MainApplication.java
  4. 2
    2
      TrigFunctions.java
  5. 44
    24
      package.bluej

+ 4
- 13
Bonus.java Zobrazit soubor

@@ -13,19 +13,10 @@ public class Bonus
13 13
        * @param number
14 14
        * @return the factorial of the number
15 15
        */
16
-      public int factorial(int curNum/**
17
-                     * Below are method calls to the TrigFunction class
18
-                     *//**
19
-                     * Below are method calls to the TrigFunction class
20
-                     *//**
21
-                     * Below are method calls to the TrigFunction class
22
-                     *//**
23
-                     * Below are method calls to the TrigFunction class
24
-                     *//**
25
-                     * Below are method calls to the TrigFunction class
26
-                     */){
27
-          int fact = 1;
28
-          for(int i = 1; i <= number; i++)
16
+      public static double factorial(double curNum)
17
+      {
18
+          double fact = 1;
19
+          for(double i = 1; i <= curNum; i++)
29 20
           {
30 21
               fact *= i;
31 22
           }

+ 7
- 7
Console.java Zobrazit soubor

@@ -122,14 +122,14 @@ public class Console {
122 122
             " 'q' : quit\n" +
123 123
             " 'l' : legend\n" +
124 124
         // Trig Functions
125
-            " 's' : sin" +
126
-            " 'x' : cosine" +
127
-            " 't' : tangent" +
128
-            " 'w' : inverse sine" +
129
-            " 'e' : inverse cosine" +
130
-            " 'r' : inverse tangent" +
125
+            " 's' : sin\n" +
126
+            " 'x' : cosine\n" +
127
+            " 't' : tangent\n" +
128
+           /* " 'w' : inverse sine\n" +
129
+            " 'e' : inverse cosine\n" +
130
+            " 'r' : inverse tangent\n" +*/
131 131
         //Bonus Functions
132
-            " 'f' : factorial"
132
+            " 'f' : factorial\n"
133 133
         );            
134 134
     }
135 135
 /*

+ 4
- 1
MainApplication.java Zobrazit soubor

@@ -150,6 +150,7 @@ public class MainApplication {
150 150
                     case 't':
151 151
                     currentNum = trig.tangent(currentNum);
152 152
                     break;
153
+                    /*
153 154
                     case 'w':
154 155
                     currentNum = trig.inverseSign(currentNum);
155 156
                     break;
@@ -159,11 +160,13 @@ public class MainApplication {
159 160
                     case 'r':
160 161
                     currentNum = trig.inverseTangent(currentNum);
161 162
                     break;
163
+                    */
162 164
                     /**
163 165
                      * Below are method calls to the Bonus class
164 166
                      */
165
-                    case 'b':
167
+                    case 'f':
166 168
                     currentNum = bonus.factorial((int) currentNum);
169
+                    break;
167 170
                     default:
168 171
                     Console.errorOperator();
169 172
                 }

+ 2
- 2
TrigFunctions.java Zobrazit soubor

@@ -10,7 +10,7 @@ public class TrigFunctions
10 10
         return sinValue;
11 11
     }
12 12
 
13
-    public static double cos(double curNum){
13
+    public static double cosine(double curNum){
14 14
         double degrees= curNum;
15 15
         double radians= Math.toRadians(degrees);
16 16
         double cosValue= Math.cos(radians);
@@ -18,7 +18,7 @@ public class TrigFunctions
18 18
         return cosValue;
19 19
     }
20 20
 
21
-    public static double tan(double curNum){
21
+    public static double tangent(double curNum){
22 22
         double degrees= curNum;
23 23
         double radians= Math.toRadians(degrees);
24 24
         double tanValue= Math.tan(radians);

+ 44
- 24
package.bluej Zobrazit soubor

@@ -1,32 +1,38 @@
1 1
 #BlueJ package file
2
-dependency1.from=CalculatorTest
3
-dependency1.to=Calculator
2
+dependency1.from=ConsoleTest
3
+dependency1.to=Console
4 4
 dependency1.type=UsesDependency
5
-dependency2.from=ConsoleTest
6
-dependency2.to=Console
5
+dependency2.from=CalculatorTest
6
+dependency2.to=Calculator
7 7
 dependency2.type=UsesDependency
8 8
 dependency3.from=MainApplication
9 9
 dependency3.to=Calculator
10 10
 dependency3.type=UsesDependency
11 11
 dependency4.from=MainApplication
12
-dependency4.to=Console
12
+dependency4.to=TrigFunctions
13 13
 dependency4.type=UsesDependency
14
-editor.fx.0.height=864
15
-editor.fx.0.width=1330
16
-editor.fx.0.x=353
17
-editor.fx.0.y=-930
14
+dependency5.from=MainApplication
15
+dependency5.to=Bonus
16
+dependency5.type=UsesDependency
17
+dependency6.from=MainApplication
18
+dependency6.to=Console
19
+dependency6.type=UsesDependency
20
+editor.fx.0.height=722
21
+editor.fx.0.width=800
22
+editor.fx.0.x=240
23
+editor.fx.0.y=24
18 24
 objectbench.height=93
19 25
 objectbench.width=1160
20 26
 package.divider.horizontal=0.5989473684210527
21
-package.divider.vertical=0.8620689655172413
22
-package.editor.height=618
27
+package.divider.vertical=0.8493975903614458
28
+package.editor.height=557
23 29
 package.editor.width=1058
24
-package.editor.x=-207
25
-package.editor.y=-938
26
-package.frame.height=783
30
+package.editor.x=10
31
+package.editor.y=23
32
+package.frame.height=722
27 33
 package.frame.width=1184
28
-package.numDependencies=4
29
-package.numTargets=5
34
+package.numDependencies=6
35
+package.numTargets=7
30 36
 package.showExtends=true
31 37
 package.showUses=true
32 38
 project.charset=UTF-8
@@ -59,16 +65,30 @@ target3.width=80
59 65
 target3.x=150
60 66
 target3.y=210
61 67
 target4.height=50
62
-target4.name=ConsoleTest
68
+target4.name=Bonus
63 69
 target4.showInterface=false
64
-target4.type=UnitTestTargetJunit4
70
+target4.type=ClassTarget
65 71
 target4.width=80
66
-target4.x=180
67
-target4.y=180
72
+target4.x=120
73
+target4.y=10
68 74
 target5.height=50
69
-target5.name=MainApplication
75
+target5.name=TrigFunctions
70 76
 target5.showInterface=false
71 77
 target5.type=ClassTarget
72
-target5.width=120
73
-target5.x=70
74
-target5.y=70
78
+target5.width=110
79
+target5.x=10
80
+target5.y=130
81
+target6.height=50
82
+target6.name=ConsoleTest
83
+target6.showInterface=false
84
+target6.type=UnitTestTargetJunit4
85
+target6.width=80
86
+target6.x=180
87
+target6.y=180
88
+target7.height=50
89
+target7.name=MainApplication
90
+target7.showInterface=false
91
+target7.type=ClassTarget
92
+target7.width=120
93
+target7.x=70
94
+target7.y=70