Bläddra i källkod

Update finished first class

Whitney Martinez 6 år sedan
förälder
incheckning
c1c77e9726
2 ändrade filer med 31 tillägg och 14 borttagningar
  1. 23
    6
      NumberUtilities.java
  2. 8
    8
      package.bluej

+ 23
- 6
NumberUtilities.java Visa fil

17
     
17
     
18
     public static String getRange(int start, int stop) {
18
     public static String getRange(int start, int stop) {
19
         String amount = "";
19
         String amount = "";
20
-        for(int i = 0; start > stop; i++){
20
+        for(int i = 0; start < stop; i++){
21
             
21
             
22
             amount += i;
22
             amount += i;
23
         
23
         
31
     public static String getRange(int start, int stop, int step) {
31
     public static String getRange(int start, int stop, int step) {
32
         
32
         
33
         String amount ="";
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
                 amount += i;
37
                 amount += i;
43
     
43
     
44
     public static String getEvenNumbers(int start, int stop) {
44
     public static String getEvenNumbers(int start, int stop) {
45
         String amount = "";
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
         return amount;
54
         return amount;
52
         
55
         
55
 
58
 
56
     public static String getOddNumbers(int start, int stop) {
59
     public static String getOddNumbers(int start, int stop) {
57
         String amount ="";
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
     public static String getExponentiations(int start, int stop, int exponent) {
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 Visa fil

8
 dependency3.from=NumberUtilitiesTest
8
 dependency3.from=NumberUtilitiesTest
9
 dependency3.to=NumberUtilities
9
 dependency3.to=NumberUtilities
10
 dependency3.type=UsesDependency
10
 dependency3.type=UsesDependency
11
-editor.fx.0.height=722
11
+editor.fx.0.height=709
12
 editor.fx.0.width=800
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
 objectbench.height=156
15
 objectbench.height=156
16
 objectbench.width=286
16
 objectbench.width=286
17
 package.divider.horizontal=0.6004098360655737
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
 package.editor.width=382
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
 package.frame.width=508
24
 package.frame.width=508
25
 package.numDependencies=3
25
 package.numDependencies=3
26
 package.numTargets=6
26
 package.numTargets=6