Aleena Rose-Mathew 6 年之前
父節點
當前提交
97cd22a341
共有 10 個文件被更改,包括 50 次插入12 次删除
  1. 二進制
      Factorial.class
  2. 7
    2
      Factorial.java
  3. 二進制
      LargestInteger.class
  4. 6
    1
      LargestInteger.java
  5. 二進制
      NormalizeAngle.class
  6. 5
    2
      NormalizeAngle.java
  7. 二進制
      ShortCalculator.class
  8. 3
    1
      ShortCalculator.ctxt
  9. 24
    1
      ShortCalculator.java
  10. 5
    5
      package.bluej

二進制
Factorial.class 查看文件


+ 7
- 2
Factorial.java 查看文件

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

二進制
LargestInteger.class 查看文件


+ 6
- 1
LargestInteger.java 查看文件

@@ -16,6 +16,11 @@ public class LargestInteger {
16 16
     }
17 17
 
18 18
     public Integer findLargestNumberUsingMathMax(Integer[] integers){
19
-        return Math.max(...integers);
19
+        int max=integers[0];
20
+        for(int i=1;i<integers.length;i++)
21
+        {
22
+            max=Math.max(integers[i],max);
23
+        }
24
+        return max;
20 25
     }
21 26
 }

二進制
NormalizeAngle.class 查看文件


+ 5
- 2
NormalizeAngle.java 查看文件

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

二進制
ShortCalculator.class 查看文件


+ 3
- 1
ShortCalculator.ctxt 查看文件

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

+ 24
- 1
ShortCalculator.java 查看文件

@@ -1,5 +1,28 @@
1
- 
2 1
 
2
+import java.util.*;
3 3
 
4 4
 public class ShortCalculator {
5
+    public static void main(String[] args){
6
+        {
7
+            Short a,b,sum,diff,pro,quo,rem;
8
+            Scanner input= new Scanner(System.in);
9
+            System.out.printf("\nEnter first number");
10
+            a=input.nextShort();
11
+            System.out.printf("\nEnter second number");
12
+            b=input.nextShort();
13
+
14
+            sum=(short)(a+b);
15
+            diff=(short)(a-b);
16
+            pro=(short)(a*b);
17
+            quo=(short)(a/b);
18
+            rem=(short)(a%b);
19
+            
20
+            System.out.printf("\nSum is %d",sum);
21
+            System.out.printf("\nDifference is :%d",diff);
22
+            System.out.printf("\nProduct is :%d",pro);
23
+            System.out.printf("\nQuotient is :%d",quo);
24
+            System.out.printf("\nThe remainder is :%d",rem);
25
+        }
26
+    }
27
+
5 28
 }

+ 5
- 5
package.bluej 查看文件

@@ -14,16 +14,16 @@ dependency4.type=UsesDependency
14 14
 editor.fx.0.height=722
15 15
 editor.fx.0.width=800
16 16
 editor.fx.0.x=240
17
-editor.fx.0.y=24
17
+editor.fx.0.y=23
18 18
 objectbench.height=101
19 19
 objectbench.width=637
20 20
 package.divider.horizontal=0.5996275605214153
21
-package.divider.vertical=0.8361153262518968
22
-package.editor.height=544
21
+package.divider.vertical=0.8358662613981763
22
+package.editor.height=543
23 23
 package.editor.width=968
24 24
 package.editor.x=137
25
-package.editor.y=213
26
-package.frame.height=717
25
+package.editor.y=23
26
+package.frame.height=716
27 27
 package.frame.width=1094
28 28
 package.numDependencies=4
29 29
 package.numTargets=10