Lewis Dominguez 6 years ago
parent
commit
649c49ca30
10 changed files with 36 additions and 23 deletions
  1. BIN
      .DS_Store
  2. BIN
      Factorial.class
  3. 5
    1
      Factorial.java
  4. BIN
      LargestInteger.class
  5. 9
    3
      LargestInteger.java
  6. BIN
      NormalizeAngle.class
  7. 2
    2
      NormalizeAngle.java
  8. BIN
      ShortCalculator.class
  9. 3
    0
      ShortCalculator.ctxt
  10. 17
    17
      package.bluej

BIN
.DS_Store View File


BIN
Factorial.class View File


+ 5
- 1
Factorial.java View File

6
 public class Factorial {
6
 public class Factorial {
7
 
7
 
8
     public BigInteger factorialOf(Integer value){
8
     public BigInteger factorialOf(Integer value){
9
-     return null;
9
+        BigInteger factorial = new BigInteger("1");
10
+        for(int i = 1; i <= value; i++) {
11
+            factorial = factorial.multiply(new BigInteger(Integer.toString(i)));
12
+        }
13
+        return factorial;
10
         
14
         
11
     }
15
     }
12
 
16
 

BIN
LargestInteger.class View File


+ 9
- 3
LargestInteger.java View File

4
 public class LargestInteger {
4
 public class LargestInteger {
5
 
5
 
6
     public Integer findLargestNumberUsingConditional(Integer[] integers){
6
     public Integer findLargestNumberUsingConditional(Integer[] integers){
7
-         
8
-        return null;
7
+        int largest = 0;
8
+        for(int i = 0; i < integers.length; i++) {
9
+            if(largest < integers[i]) {
10
+            largest = integers[i];
11
+            }
12
+        }
13
+        return largest;
9
     }
14
     }
10
 
15
 
11
     public Integer findLargestNumberUsingMathMax(Integer[] integers){
16
     public Integer findLargestNumberUsingMathMax(Integer[] integers){
12
-        return null;
17
+        int maxNumber = Math.max(integers[0], Math.max(integers[1], integers[2]));
18
+        return maxNumber;
13
     }
19
     }
14
 }
20
 }

BIN
NormalizeAngle.class View File


+ 2
- 2
NormalizeAngle.java View File

4
 public class NormalizeAngle {
4
 public class NormalizeAngle {
5
 
5
 
6
     public Integer normalizeValueUsingModulo(Integer angle){
6
     public Integer normalizeValueUsingModulo(Integer angle){
7
-        return 0;
7
+        return angle % 360;
8
     }
8
     }
9
 
9
 
10
     public Integer normalizeValueUsingFloorMod(Integer integer){
10
     public Integer normalizeValueUsingFloorMod(Integer integer){
11
-        return 0;
11
+        return Math.floorMod(780, 360);
12
     }
12
     }
13
 
13
 
14
     public static void main(String[] args){
14
     public static void main(String[] args){

BIN
ShortCalculator.class View File


+ 3
- 0
ShortCalculator.ctxt View File

1
+#BlueJ class context
2
+comment0.target=ShortCalculator
3
+numComments=1

+ 17
- 17
package.bluej View File

1
 #BlueJ package file
1
 #BlueJ package file
2
-dependency1.from=LargestIntegerTest
3
-dependency1.to=LargestInteger
2
+dependency1.from=IntegerPrinterTest
3
+dependency1.to=IntegerPrinter
4
 dependency1.type=UsesDependency
4
 dependency1.type=UsesDependency
5
-dependency2.from=IntegerPrinterTest
6
-dependency2.to=IntegerPrinter
5
+dependency2.from=FactorialTest
6
+dependency2.to=Factorial
7
 dependency2.type=UsesDependency
7
 dependency2.type=UsesDependency
8
-dependency3.from=FactorialTest
9
-dependency3.to=Factorial
8
+dependency3.from=NormalizeAngleTest
9
+dependency3.to=NormalizeAngle
10
 dependency3.type=UsesDependency
10
 dependency3.type=UsesDependency
11
-dependency4.from=NormalizeAngleTest
12
-dependency4.to=NormalizeAngle
11
+dependency4.from=LargestIntegerTest
12
+dependency4.to=LargestInteger
13
 dependency4.type=UsesDependency
13
 dependency4.type=UsesDependency
14
-editor.fx.0.height=731
15
-editor.fx.0.width=834
16
-editor.fx.0.x=272
17
-editor.fx.0.y=38
14
+editor.fx.0.height=709
15
+editor.fx.0.width=1079
16
+editor.fx.0.x=201
17
+editor.fx.0.y=31
18
 objectbench.height=101
18
 objectbench.height=101
19
-objectbench.width=620
19
+objectbench.width=822
20
 package.divider.horizontal=0.6
20
 package.divider.horizontal=0.6
21
 package.divider.vertical=0.823240589198036
21
 package.divider.vertical=0.823240589198036
22
 package.editor.height=496
22
 package.editor.height=496
23
-package.editor.width=518
24
-package.editor.x=-7
25
-package.editor.y=23
23
+package.editor.width=720
24
+package.editor.x=35
25
+package.editor.y=80
26
 package.frame.height=669
26
 package.frame.height=669
27
-package.frame.width=644
27
+package.frame.width=846
28
 package.numDependencies=4
28
 package.numDependencies=4
29
 package.numTargets=10
29
 package.numTargets=10
30
 package.showExtends=true
30
 package.showExtends=true