Lewis Dominguez 6 gadus atpakaļ
vecāks
revīzija
649c49ca30
10 mainītis faili ar 36 papildinājumiem un 23 dzēšanām
  1. Binārs
      .DS_Store
  2. Binārs
      Factorial.class
  3. 5
    1
      Factorial.java
  4. Binārs
      LargestInteger.class
  5. 9
    3
      LargestInteger.java
  6. Binārs
      NormalizeAngle.class
  7. 2
    2
      NormalizeAngle.java
  8. Binārs
      ShortCalculator.class
  9. 3
    0
      ShortCalculator.ctxt
  10. 17
    17
      package.bluej

Binārs
.DS_Store Parādīt failu


Binārs
Factorial.class Parādīt failu


+ 5
- 1
Factorial.java Parādīt failu

@@ -6,7 +6,11 @@ import java.math.BigInteger;
6 6
 public class Factorial {
7 7
 
8 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ārs
LargestInteger.class Parādīt failu


+ 9
- 3
LargestInteger.java Parādīt failu

@@ -4,11 +4,17 @@ import java.lang.Math;
4 4
 public class LargestInteger {
5 5
 
6 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 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ārs
NormalizeAngle.class Parādīt failu


+ 2
- 2
NormalizeAngle.java Parādīt failu

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

Binārs
ShortCalculator.class Parādīt failu


+ 3
- 0
ShortCalculator.ctxt Parādīt failu

@@ -0,0 +1,3 @@
1
+#BlueJ class context
2
+comment0.target=ShortCalculator
3
+numComments=1

+ 17
- 17
package.bluej Parādīt failu

@@ -1,30 +1,30 @@
1 1
 #BlueJ package file
2
-dependency1.from=LargestIntegerTest
3
-dependency1.to=LargestInteger
2
+dependency1.from=IntegerPrinterTest
3
+dependency1.to=IntegerPrinter
4 4
 dependency1.type=UsesDependency
5
-dependency2.from=IntegerPrinterTest
6
-dependency2.to=IntegerPrinter
5
+dependency2.from=FactorialTest
6
+dependency2.to=Factorial
7 7
 dependency2.type=UsesDependency
8
-dependency3.from=FactorialTest
9
-dependency3.to=Factorial
8
+dependency3.from=NormalizeAngleTest
9
+dependency3.to=NormalizeAngle
10 10
 dependency3.type=UsesDependency
11
-dependency4.from=NormalizeAngleTest
12
-dependency4.to=NormalizeAngle
11
+dependency4.from=LargestIntegerTest
12
+dependency4.to=LargestInteger
13 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 18
 objectbench.height=101
19
-objectbench.width=620
19
+objectbench.width=822
20 20
 package.divider.horizontal=0.6
21 21
 package.divider.vertical=0.823240589198036
22 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 26
 package.frame.height=669
27
-package.frame.width=644
27
+package.frame.width=846
28 28
 package.numDependencies=4
29 29
 package.numTargets=10
30 30
 package.showExtends=true