Aleena Rose-Mathew 6 anni fa
parent
commit
97cd22a341

BIN
Factorial.class Vedi File


+ 7
- 2
Factorial.java Vedi File

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

BIN
LargestInteger.class Vedi File


+ 6
- 1
LargestInteger.java Vedi File

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

BIN
NormalizeAngle.class Vedi File


+ 5
- 2
NormalizeAngle.java Vedi File

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

BIN
ShortCalculator.class Vedi File


+ 3
- 1
ShortCalculator.ctxt Vedi File

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

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

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