jpsp91 6 lat temu
rodzic
commit
99f05dba20

BIN
Factorial.class Wyświetl plik


+ 5
- 0
Factorial.ctxt Wyświetl plik

@@ -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

BIN
FactorialTest.class Wyświetl plik


+ 7
- 0
FactorialTest.ctxt Wyświetl plik

@@ -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 Wyświetl plik


+ 11
- 0
IntegerPrinter.ctxt Wyświetl plik

@@ -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

+ 6
- 4
IntegerPrinter.java Wyświetl plik

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

BIN
IntegerPrinterTest.class Wyświetl plik


+ 11
- 0
IntegerPrinterTest.ctxt Wyświetl plik

@@ -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

+ 0
- 3
IntegerPrinterTest.java Wyświetl plik

@@ -1,6 +1,3 @@
1
- 
2
-
3
-
4 1
 import org.junit.Assert;
5 2
 import org.junit.Before;
6 3
 import org.junit.Test;

BIN
LargestInteger.class Wyświetl plik


+ 7
- 0
LargestInteger.ctxt Wyświetl plik

@@ -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

+ 20
- 4
LargestInteger.java Wyświetl plik

@@ -1,13 +1,29 @@
1
- 
2
-
1
+import java.util.*;
3 2
 
4 3
 public class LargestInteger {
5 4
 
6 5
     public Integer findLargestNumberUsingConditional(Integer[] integers){
7
-        return null;
6
+
7
+        //30,20,10
8
+
9
+        int maxValue = 0;
10
+
11
+        int count = 0;
12
+
13
+        for (count = 0; count < integers.length; count++){
14
+
15
+            if(integers[count]>maxValue){
16
+                maxValue = integers[count];
17
+            }
18
+
19
+            //return maxValue;
20
+        }
21
+        
22
+        return maxValue;
8 23
     }
9 24
 
10 25
     public Integer findLargestNumberUsingMathMax(Integer[] integers){
11
-        return null;
26
+        return Math.max(integers[0],(Math.max(integers[1], integers[2])));
12 27
     }
28
+
13 29
 }

BIN
LargestIntegerTest.class Wyświetl plik


+ 9
- 0
LargestIntegerTest.ctxt Wyświetl plik

@@ -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 Wyświetl plik


+ 9
- 0
NormalizeAngle.ctxt Wyświetl plik

@@ -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

+ 3
- 3
NormalizeAngle.java Wyświetl plik

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

BIN
NormalizeAngleTest.class Wyświetl plik


+ 9
- 0
NormalizeAngleTest.ctxt Wyświetl plik

@@ -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 Wyświetl plik


+ 3
- 0
ShortCalculator.ctxt Wyświetl plik

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

BIN
ShortCalculatorTest.class Wyświetl plik


+ 13
- 0
ShortCalculatorTest.ctxt Wyświetl plik

@@ -0,0 +1,13 @@
1
+#BlueJ class context
2
+comment0.target=ShortCalculatorTest
3
+comment0.text=\n\ The\ test\ class\ ShortCalculatorTest.\n\n\ @author\ \ (your\ name)\n\ @version\ (a\ version\ number\ or\ a\ date)\n
4
+comment1.params=
5
+comment1.target=ShortCalculatorTest()
6
+comment1.text=\n\ Default\ constructor\ for\ test\ class\ ShortCalculatorTest\n
7
+comment2.params=
8
+comment2.target=void\ setUp()
9
+comment2.text=\n\ Sets\ up\ the\ test\ fixture.\n\n\ Called\ before\ every\ test\ case\ method.\n
10
+comment3.params=
11
+comment3.target=void\ tearDown()
12
+comment3.text=\n\ Tears\ down\ the\ test\ fixture.\n\n\ Called\ after\ every\ test\ case\ method.\n
13
+numComments=4

+ 32
- 2
ShortCalculatorTest.java Wyświetl plik

@@ -1,5 +1,35 @@
1
- 
1
+import static org.junit.Assert.*;
2
+import org.junit.After;
3
+import org.junit.Before;
4
+import org.junit.Test;
2 5
 
3 6
 
4
-public class ShortCalculatorTest {
7
+public class ShortCalculatorTest
8
+{
9
+    /**
10
+     * Default constructor for test class ShortCalculatorTest
11
+     */
12
+    public ShortCalculatorTest()
13
+    {
14
+    }
15
+
16
+    /**
17
+     * Sets up the test fixture.
18
+     *
19
+     * Called before every test case method.
20
+     */
21
+    @Before
22
+    public void setUp()
23
+    {
24
+    }
25
+
26
+    /**
27
+     * Tears down the test fixture.
28
+     *
29
+     * Called after every test case method.
30
+     */
31
+    @After
32
+    public void tearDown()
33
+    {
34
+    }
5 35
 }

BIN
Test.class Wyświetl plik


+ 5
- 0
Test.ctxt Wyświetl plik

@@ -0,0 +1,5 @@
1
+#BlueJ class context
2
+comment0.target=Test
3
+comment1.params=args
4
+comment1.target=void\ main(java.lang.String[])
5
+numComments=2

+ 22
- 0
Test.java Wyświetl plik

@@ -0,0 +1,22 @@
1
+import java.util.Arrays;
2
+public class Test
3
+{
4
+
5
+    public static void main(String[] args) {
6
+        
7
+        int[] numbers = {0, 3, 2, 1, 5, 4};
8
+        
9
+        Arrays.sort(numbers);
10
+        
11
+        System.out.println(Arrays.toString(numbers));
12
+        
13
+        int x = numbers.length;
14
+        
15
+        System.out.println(x);
16
+        
17
+        System.out.println(numbers[x]);
18
+        
19
+        
20
+    }
21
+
22
+}

+ 1
- 1
package.bluej Wyświetl plik

@@ -22,7 +22,7 @@ package.divider.vertical=0.837593984962406
22 22
 package.editor.height=550
23 23
 package.editor.width=968
24 24
 package.editor.x=59
25
-package.editor.y=82
25
+package.editor.y=24
26 26
 package.frame.height=723
27 27
 package.frame.width=1094
28 28
 package.numDependencies=4