Bladeren bron

Update finished first class

Whitney Martinez 6 jaren geleden
bovenliggende
commit
c1c77e9726
2 gewijzigde bestanden met toevoegingen van 31 en 14 verwijderingen
  1. 23
    6
      NumberUtilities.java
  2. 8
    8
      package.bluej

+ 23
- 6
NumberUtilities.java Bestand weergeven

@@ -17,7 +17,7 @@ public class NumberUtilities {
17 17
     
18 18
     public static String getRange(int start, int stop) {
19 19
         String amount = "";
20
-        for(int i = 0; start > stop; i++){
20
+        for(int i = 0; start < stop; i++){
21 21
             
22 22
             amount += i;
23 23
         
@@ -31,7 +31,7 @@ public class NumberUtilities {
31 31
     public static String getRange(int start, int stop, int step) {
32 32
         
33 33
         String amount ="";
34
-            for(int i = 0; start > stop; i+=step){
34
+            for(int i = 0; start < stop; i+=step){
35 35
               
36 36
                 
37 37
                 amount += i;
@@ -43,10 +43,13 @@ public class NumberUtilities {
43 43
     
44 44
     public static String getEvenNumbers(int start, int stop) {
45 45
         String amount = "";
46
-        int j = 2 % stop;
47 46
         
48
-        for(int i = 0; start > stop; i+=j){
49
-           amount +=  i; 
47
+        
48
+        for(int i = start; i < stop; i++){
49
+            if (i % 2 == 0) {
50
+                
51
+                amount +=  i; 
52
+            }
50 53
         }
51 54
         return amount;
52 55
         
@@ -55,10 +58,24 @@ public class NumberUtilities {
55 58
 
56 59
     public static String getOddNumbers(int start, int stop) {
57 60
         String amount ="";
61
+        
62
+        for(int i = start; i < stop; i++){
63
+           if(i % 3 == 1 ){
64
+            amount += i;
65
+        }
66
+        }
67
+        return amount; 
68
+        
58 69
     }
59 70
 
60 71
 
61 72
     public static String getExponentiations(int start, int stop, int exponent) {
62
-        return null;
73
+        String amount = "";
74
+          
75
+            for(int i =start; start < stop; i++){
76
+                  amount += (int) Math.pow(start, exponent);
77
+            }
78
+            return amount;
79
+            
63 80
     }
64 81
 }

+ 8
- 8
package.bluej Bestand weergeven

@@ -8,19 +8,19 @@ dependency2.type=UsesDependency
8 8
 dependency3.from=NumberUtilitiesTest
9 9
 dependency3.to=NumberUtilities
10 10
 dependency3.type=UsesDependency
11
-editor.fx.0.height=722
11
+editor.fx.0.height=709
12 12
 editor.fx.0.width=800
13
-editor.fx.0.x=990
14
-editor.fx.0.y=235
13
+editor.fx.0.x=467
14
+editor.fx.0.y=-947
15 15
 objectbench.height=156
16 16
 objectbench.width=286
17 17
 package.divider.horizontal=0.6004098360655737
18
-package.divider.vertical=0.7556221889055472
19
-package.editor.height=497
18
+package.divider.vertical=0.7496159754224271
19
+package.editor.height=481
20 20
 package.editor.width=382
21
-package.editor.x=361
22
-package.editor.y=451
23
-package.frame.height=725
21
+package.editor.x=-45
22
+package.editor.y=-914
23
+package.frame.height=709
24 24
 package.frame.width=508
25 25
 package.numDependencies=3
26 26
 package.numTargets=6