Nicholas Maidanos hace 6 años
padre
commit
07075dd936

BIN
Factorial.class Ver fichero


+ 5
- 0
Factorial.ctxt Ver fichero

@@ -0,0 +1,5 @@
1
+#BlueJ class context
2
+comment0.target=Factorial
3
+comment1.params=value
4
+comment1.target=java.math.BigInteger\ factorialOf(java.lang.Integer)
5
+numComments=2

+ 7
- 1
Factorial.java Ver fichero

@@ -6,7 +6,13 @@ import java.math.BigInteger;
6 6
 public class Factorial {
7 7
 
8 8
     public BigInteger factorialOf(Integer value){
9
-        return null;
9
+        BigInteger bigInt = new BigInteger("1");
10
+
11
+        for(int i = 1; i <= value; i++){
12
+           bigInt = bigInt.multiply((new BigInteger(i + "")));
13
+        }
14
+
15
+        return bigInt;
10 16
     }
11 17
 
12 18
 }

BIN
FactorialTest.class Ver fichero


+ 7
- 0
FactorialTest.ctxt Ver fichero

@@ -0,0 +1,7 @@
1
+#BlueJ class context
2
+comment0.target=FactorialTest
3
+comment1.params=
4
+comment1.target=void\ setUp()
5
+comment2.params=
6
+comment2.target=void\ factorialOfTest()
7
+numComments=3

BIN
IntegerPrinter.class Ver fichero


+ 11
- 0
IntegerPrinter.ctxt Ver fichero

@@ -0,0 +1,11 @@
1
+#BlueJ class context
2
+comment0.target=IntegerPrinter
3
+comment1.params=value
4
+comment1.target=java.lang.String\ printIntegerAsBinary(int)
5
+comment2.params=value
6
+comment2.target=java.lang.String\ printIntegerAsOctal(int)
7
+comment3.params=value
8
+comment3.target=java.lang.String\ printIntegerAsHexadecimal(int)
9
+comment4.params=args
10
+comment4.target=void\ main(java.lang.String[])
11
+numComments=5

+ 3
- 3
IntegerPrinter.java Ver fichero

@@ -4,15 +4,15 @@
4 4
 public class IntegerPrinter {
5 5
 
6 6
     public String printIntegerAsBinary(int value){
7
-        return null;
7
+        return Integer.toBinaryString(value);
8 8
     }
9 9
 
10 10
     public String printIntegerAsOctal(int value){
11
-        return null;
11
+        return Integer.toOctalString(value);
12 12
     }
13 13
 
14 14
     public String printIntegerAsHexadecimal(int value){
15
-        return null;
15
+        return Integer.toHexString(value);
16 16
     }
17 17
 
18 18
     public static void main(String[] args){

BIN
IntegerPrinterTest.class Ver fichero


+ 11
- 0
IntegerPrinterTest.ctxt Ver fichero

@@ -0,0 +1,11 @@
1
+#BlueJ class context
2
+comment0.target=IntegerPrinterTest
3
+comment1.params=
4
+comment1.target=void\ setUp()
5
+comment2.params=
6
+comment2.target=void\ printIntegerAsBinaryTest()
7
+comment3.params=
8
+comment3.target=void\ printIntegerAsHexadecimal()
9
+comment4.params=
10
+comment4.target=void\ printIntegerAsOctalTest()
11
+numComments=5

BIN
LargestInteger.class Ver fichero


+ 7
- 0
LargestInteger.ctxt Ver fichero

@@ -0,0 +1,7 @@
1
+#BlueJ class context
2
+comment0.target=LargestInteger
3
+comment1.params=integers
4
+comment1.target=java.lang.Integer\ findLargestNumberUsingConditional(java.lang.Integer[])
5
+comment2.params=integers
6
+comment2.target=java.lang.Integer\ findLargestNumberUsingMathMax(java.lang.Integer[])
7
+numComments=3

+ 18
- 2
LargestInteger.java Ver fichero

@@ -4,10 +4,26 @@
4 4
 public class LargestInteger {
5 5
 
6 6
     public Integer findLargestNumberUsingConditional(Integer[] integers){
7
-        return null;
7
+        
8
+        int largestInt = 0;
9
+        for(int i = 0; i < integers.length; i++){
10
+            if(integers[i] > largestInt){
11
+                largestInt = integers[i];
12
+            }
13
+            System.out.print(i);
14
+        }
15
+        
16
+        return largestInt;
17
+        
8 18
     }
9 19
 
10 20
     public Integer findLargestNumberUsingMathMax(Integer[] integers){
11
-        return null;
21
+        int largestInt = 0;
22
+        for(int i = 0; i < integers.length; i++){
23
+            largestInt = Math.max(largestInt, integers[i]);
24
+        }
25
+        
26
+        return largestInt;        
27
+        
12 28
     }
13 29
 }

BIN
LargestIntegerTest.class Ver fichero


+ 9
- 0
LargestIntegerTest.ctxt Ver fichero

@@ -0,0 +1,9 @@
1
+#BlueJ class context
2
+comment0.target=LargestIntegerTest
3
+comment1.params=
4
+comment1.target=void\ setUp()
5
+comment2.params=
6
+comment2.target=void\ findLargestNumberUsingConditionalTest()
7
+comment3.params=
8
+comment3.target=void\ findLargestNumberUsingMathMaxTest()
9
+numComments=4

BIN
NormalizeAngle.class Ver fichero


+ 9
- 0
NormalizeAngle.ctxt Ver fichero

@@ -0,0 +1,9 @@
1
+#BlueJ class context
2
+comment0.target=NormalizeAngle
3
+comment1.params=angle
4
+comment1.target=java.lang.Integer\ normalizeValueUsingModulo(java.lang.Integer)
5
+comment2.params=integer
6
+comment2.target=java.lang.Integer\ normalizeValueUsingFloorMod(java.lang.Integer)
7
+comment3.params=args
8
+comment3.target=void\ main(java.lang.String[])
9
+numComments=4

BIN
NormalizeAngleTest.class Ver fichero


+ 9
- 0
NormalizeAngleTest.ctxt Ver fichero

@@ -0,0 +1,9 @@
1
+#BlueJ class context
2
+comment0.target=NormalizeAngleTest
3
+comment1.params=
4
+comment1.target=void\ setUp()
5
+comment2.params=
6
+comment2.target=void\ normalizeValueUsingModuloTest()
7
+comment3.params=
8
+comment3.target=void\ normalizeValueUsingFloorModTest()
9
+numComments=4

BIN
ShortCalculator.class Ver fichero


+ 5
- 0
ShortCalculator.ctxt Ver fichero

@@ -0,0 +1,5 @@
1
+#BlueJ class context
2
+comment0.target=ShortCalculator
3
+comment1.params=
4
+comment1.target=void\ ShortCalculator()
5
+numComments=2

+ 68
- 1
ShortCalculator.java Ver fichero

@@ -1,5 +1,72 @@
1 1
  
2
-
2
+import java.util.Scanner;
3 3
 
4 4
 public class ShortCalculator {
5
+
6
+
7
+    public static short S1;
8
+
9
+    public static short S2;
10
+
11
+
12
+    public static short sum;
13
+
14
+    public static short diff;
15
+
16
+    public static short product;
17
+
18
+    public static short quotient;
19
+
20
+    public static short remainder;
21
+
22
+
23
+
24
+
25
+
26
+    public static void ShortCalculator(){
27
+
28
+        Scanner scanner = new Scanner(System.in);
29
+
30
+        System.out.println("Enter your first Short: ");
31
+
32
+        S1 = scanner.nextShort();
33
+
34
+
35
+
36
+        System.out.println("Enter your Second Short: ");
37
+
38
+        S2 = scanner.nextShort();
39
+
40
+
41
+
42
+        System.out.println(S1);
43
+
44
+        System.out.println(S2);
45
+
46
+
47
+
48
+        sum       = (short) (S1 + S2);
49
+
50
+        diff      = (short) (S1 - S2);
51
+
52
+        product   = (short) (S1 * S2);
53
+
54
+        quotient  = (short) (S1 / S2);
55
+
56
+        remainder = (short) (S1 % S2);
57
+
58
+
59
+
60
+        System.out.println("Sum is " + sum);
61
+
62
+        System.out.println("Diff is " + diff);
63
+
64
+        System.out.println("Product is " + product);
65
+
66
+        System.out.println("Quotient is " + quotient);
67
+
68
+        System.out.println("Remainder is " + remainder);
69
+
70
+
71
+        }
5 72
 }

BIN
ShortCalculatorTest.class Ver fichero


+ 3
- 0
ShortCalculatorTest.ctxt Ver fichero

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

+ 13
- 13
package.bluej Ver fichero

@@ -11,20 +11,20 @@ dependency3.type=UsesDependency
11 11
 dependency4.from=IntegerPrinterTest
12 12
 dependency4.to=IntegerPrinter
13 13
 dependency4.type=UsesDependency
14
-editor.fx.0.height=0
14
+editor.fx.0.height=22
15 15
 editor.fx.0.width=0
16
-editor.fx.0.x=0
17
-editor.fx.0.y=0
18
-objectbench.height=101
19
-objectbench.width=1070
20
-package.divider.horizontal=0.6
21
-package.divider.vertical=0.837593984962406
22
-package.editor.height=550
23
-package.editor.width=968
24
-package.editor.x=59
25
-package.editor.y=82
26
-package.frame.height=723
27
-package.frame.width=1094
16
+editor.fx.0.x=40
17
+editor.fx.0.y=685
18
+objectbench.height=94
19
+objectbench.width=501
20
+package.divider.horizontal=0.6334164588528678
21
+package.divider.vertical=0.7765486725663717
22
+package.editor.height=344
23
+package.editor.width=680
24
+package.editor.x=556
25
+package.editor.y=63
26
+package.frame.height=510
27
+package.frame.width=822
28 28
 package.numDependencies=4
29 29
 package.numTargets=10
30 30
 package.showExtends=true