Mexi Liang 6 年前
父节点
当前提交
cd9ca5d53e
共有 23 个文件被更改,包括 150 次插入46 次删除
  1. 二进制
      .DS_Store
  2. 二进制
      Factorial.class
  3. 5
    0
      Factorial.ctxt
  4. 7
    4
      Factorial.java
  5. 二进制
      FactorialTest.class
  6. 7
    0
      FactorialTest.ctxt
  7. 二进制
      IntegerPrinter.class
  8. 11
    0
      IntegerPrinter.ctxt
  9. 4
    5
      IntegerPrinter.java
  10. 21
    0
      IntegerPrinter.java#backup
  11. 二进制
      IntegerPrinterTest.class
  12. 11
    0
      IntegerPrinterTest.ctxt
  13. 二进制
      LargestInteger.class
  14. 7
    0
      LargestInteger.ctxt
  15. 16
    5
      LargestInteger.java
  16. 二进制
      LargestIntegerTest.class
  17. 9
    0
      LargestIntegerTest.ctxt
  18. 二进制
      NormalizeAngle.class
  19. 9
    0
      NormalizeAngle.ctxt
  20. 7
    5
      NormalizeAngle.java
  21. 二进制
      NormalizeAngleTest.class
  22. 9
    0
      NormalizeAngleTest.ctxt
  23. 27
    27
      package.bluej

二进制
.DS_Store 查看文件


二进制
Factorial.class 查看文件


+ 5
- 0
Factorial.ctxt 查看文件

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
- 4
Factorial.java 查看文件

1
- 
2
-
3
 
1
 
4
 import java.math.BigInteger;
2
 import java.math.BigInteger;
5
 
3
 
6
 public class Factorial {
4
 public class Factorial {
7
 
5
 
8
     public BigInteger factorialOf(Integer value){
6
     public BigInteger factorialOf(Integer value){
9
-        return null;
7
+
8
+        BigInteger n = BigInteger.valueOf(1);
9
+        for (int i=2; i <=value; i++){ 
10
+            n= n.multiply(BigInteger.valueOf(i));
11
+        }
12
+        return n;
10
     }
13
     }
11
 
14
 
12
-}
15
+}

二进制
FactorialTest.class 查看文件


+ 7
- 0
FactorialTest.ctxt 查看文件

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

二进制
IntegerPrinter.class 查看文件


+ 11
- 0
IntegerPrinter.ctxt 查看文件

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

+ 4
- 5
IntegerPrinter.java 查看文件

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

+ 21
- 0
IntegerPrinter.java#backup 查看文件

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

二进制
IntegerPrinterTest.class 查看文件


+ 11
- 0
IntegerPrinterTest.ctxt 查看文件

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

二进制
LargestInteger.class 查看文件


+ 7
- 0
LargestInteger.ctxt 查看文件

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

+ 16
- 5
LargestInteger.java 查看文件

1
- 
1
+ import java.lang.*;
2
 
2
 
3
 
3
 
4
 public class LargestInteger {
4
 public class LargestInteger {
5
 
5
 
6
     public Integer findLargestNumberUsingConditional(Integer[] integers){
6
     public Integer findLargestNumberUsingConditional(Integer[] integers){
7
-        return null;
8
-    }
7
+        Integer largest = 0;
8
+        for (int i=0;i<integers.length;i++){
9
+            if (integers[i]>largest)
10
+            largest = integers[i];
11
+        }
12
+        return largest;
13
+        }
14
+        
15
+    
9
 
16
 
10
     public Integer findLargestNumberUsingMathMax(Integer[] integers){
17
     public Integer findLargestNumberUsingMathMax(Integer[] integers){
11
-        return null;
18
+        int x = 300;
19
+        int y = 200;
20
+        int z = 600;
21
+        return Math.max(Math.max(x,y),z) ;
12
     }
22
     }
13
-}
23
+
24
+}

二进制
LargestIntegerTest.class 查看文件


+ 9
- 0
LargestIntegerTest.ctxt 查看文件

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

二进制
NormalizeAngle.class 查看文件


+ 9
- 0
NormalizeAngle.ctxt 查看文件

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

+ 7
- 5
NormalizeAngle.java 查看文件

1
- 
2
-
1
+import java.lang.Math;
3
 
2
 
4
 public class NormalizeAngle {
3
 public class NormalizeAngle {
5
 
4
 
6
     public Integer normalizeValueUsingModulo(Integer angle){
5
     public Integer normalizeValueUsingModulo(Integer angle){
7
-        return 0;
6
+        Integer n = angle % 360;
7
+
8
+        return n;
8
     }
9
     }
9
 
10
 
10
     public Integer normalizeValueUsingFloorMod(Integer integer){
11
     public Integer normalizeValueUsingFloorMod(Integer integer){
11
-        return 0;
12
+
13
+        return Math.floorMod(integer,360);
12
     }
14
     }
13
 
15
 
14
     public static void main(String[] args){
16
     public static void main(String[] args){
15
 
17
 
16
     }
18
     }
17
-}
19
+}

二进制
NormalizeAngleTest.class 查看文件


+ 9
- 0
NormalizeAngleTest.ctxt 查看文件

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

+ 27
- 27
package.bluej 查看文件

1
 #BlueJ package file
1
 #BlueJ package file
2
-dependency1.from=LargestIntegerTest
3
-dependency1.to=LargestInteger
2
+dependency1.from=NormalizeAngleTest
3
+dependency1.to=NormalizeAngle
4
 dependency1.type=UsesDependency
4
 dependency1.type=UsesDependency
5
-dependency2.from=NormalizeAngleTest
6
-dependency2.to=NormalizeAngle
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=LargestIntegerTest
9
+dependency3.to=LargestInteger
10
 dependency3.type=UsesDependency
10
 dependency3.type=UsesDependency
11
 dependency4.from=IntegerPrinterTest
11
 dependency4.from=IntegerPrinterTest
12
 dependency4.to=IntegerPrinter
12
 dependency4.to=IntegerPrinter
13
 dependency4.type=UsesDependency
13
 dependency4.type=UsesDependency
14
-editor.fx.0.height=0
15
-editor.fx.0.width=0
16
-editor.fx.0.x=0
17
-editor.fx.0.y=0
18
-objectbench.height=101
14
+editor.fx.0.height=709
15
+editor.fx.0.width=800
16
+editor.fx.0.x=240
17
+editor.fx.0.y=23
18
+objectbench.height=231
19
 objectbench.width=1070
19
 objectbench.width=1070
20
 package.divider.horizontal=0.6
20
 package.divider.horizontal=0.6
21
-package.divider.vertical=0.837593984962406
22
-package.editor.height=550
23
-package.editor.width=968
21
+package.divider.vertical=0.6344086021505376
22
+package.editor.height=406
23
+package.editor.width=953
24
 package.editor.x=59
24
 package.editor.x=59
25
-package.editor.y=82
26
-package.frame.height=723
25
+package.editor.y=23
26
+package.frame.height=709
27
 package.frame.width=1094
27
 package.frame.width=1094
28
 package.numDependencies=4
28
 package.numDependencies=4
29
 package.numTargets=10
29
 package.numTargets=10
53
 target2.name=NormalizeAngle
53
 target2.name=NormalizeAngle
54
 target2.showInterface=false
54
 target2.showInterface=false
55
 target2.type=ClassTarget
55
 target2.type=ClassTarget
56
-target2.width=120
56
+target2.width=130
57
 target2.x=70
57
 target2.x=70
58
 target2.y=70
58
 target2.y=70
59
 target3.height=50
59
 target3.height=50
67
 target4.name=ShortCalculator
67
 target4.name=ShortCalculator
68
 target4.showInterface=false
68
 target4.showInterface=false
69
 target4.type=ClassTarget
69
 target4.type=ClassTarget
70
-target4.width=120
70
+target4.width=130
71
 target4.x=130
71
 target4.x=130
72
 target4.y=130
72
 target4.y=130
73
 target5.height=50
73
 target5.height=50
81
 target6.name=LargestIntegerTest
81
 target6.name=LargestIntegerTest
82
 target6.showInterface=false
82
 target6.showInterface=false
83
 target6.type=UnitTestTargetJunit4
83
 target6.type=UnitTestTargetJunit4
84
-target6.width=140
84
+target6.width=150
85
 target6.x=250
85
 target6.x=250
86
 target6.y=190
86
 target6.y=190
87
 target7.height=50
87
 target7.height=50
92
 target7.x=10
92
 target7.x=10
93
 target7.y=250
93
 target7.y=250
94
 target8.height=50
94
 target8.height=50
95
-target8.name=NormalizeAngleTest
95
+target8.name=FactorialTest
96
 target8.showInterface=false
96
 target8.showInterface=false
97
 target8.type=UnitTestTargetJunit4
97
 target8.type=UnitTestTargetJunit4
98
-target8.width=150
99
-target8.x=10
100
-target8.y=310
98
+target8.width=110
99
+target8.x=410
100
+target8.y=260
101
 target9.height=50
101
 target9.height=50
102
-target9.name=FactorialTest
102
+target9.name=NormalizeAngleTest
103
 target9.showInterface=false
103
 target9.showInterface=false
104
 target9.type=UnitTestTargetJunit4
104
 target9.type=UnitTestTargetJunit4
105
-target9.width=110
106
-target9.x=410
107
-target9.y=260
105
+target9.width=150
106
+target9.x=10
107
+target9.y=310