Brandon Defrancis vor 8 Jahren
Ursprung
Commit
2fec85ad19
1 geänderte Dateien mit 42 neuen und 9 gelöschten Zeilen
  1. 42
    9
      WriteLoops.java

+ 42
- 9
WriteLoops.java Datei anzeigen

99
         // Write a nested FOR loop(s), where one counts from
99
         // Write a nested FOR loop(s), where one counts from
100
         // 0 to less than 20 and the inner one counts from 0 to 4
100
         // 0 to less than 20 and the inner one counts from 0 to 4
101
                 // calling
101
                 // calling
102
+        for (int i = 0; i < 20; i++){
103
+            
104
+            for (int j = 0; j <=4; j++){
102
                 w = w + 1;
105
                 w = w + 1;
106
+            }
107
+        }
103
                 // each time through the inner loop
108
                 // each time through the inner loop
104
 
109
 
105
         return w;
110
         return w;
114
         // prints “Hello Zipcode” instead of the statement w = w + 1;
119
         // prints “Hello Zipcode” instead of the statement w = w + 1;
115
 
120
 
116
                 // calling
121
                 // calling
117
-                w = w + 1;
122
+                for (int i = 5; i<=105; i++) {
123
+                    if (i > 51) {
124
+                        System.out.println("Hello Zipcode");
125
+                    }
126
+                    else {
127
+                        w = w + 1;
128
+                    }
129
+            }
130
+        
118
             // each time through the inner loop
131
             // each time through the inner loop
119
         
132
         
120
         return w;
133
         return w;
145
         int w = 0;
158
         int w = 0;
146
 
159
 
147
         // you need to use a .equals for two Strings.
160
         // you need to use a .equals for two Strings.
148
-
161
+        while (!gpsCurrentLocation().equals("Home")){
162
+            driveSomeMore();
163
+            
164
+        
149
             // calling
165
             // calling
150
             w = w + 1;
166
             w = w + 1;
151
             // each time through the inner loop
167
             // each time through the inner loop
168
+        }
169
+        System.out.println("Honey, I'm Home!");
152
         
170
         
153
 
171
 
154
-            return w;
172
+        return w;
155
     }
173
     }
156
 
174
 
157
     // Getting harder...
175
     // Getting harder...
167
         int runningScore = 0;
185
         int runningScore = 0;
168
 
186
 
169
         // do your while loop here
187
         // do your while loop here
170
- 
171
-            // calling
188
+        while ( runningScore < highestScore ){
189
+            runningScore = currentScore + runningScore;
172
             w = w + 1;
190
             w = w + 1;
191
+            currentScore = gameNextScore();
192
+            
193
+            // calling            
173
             // each time through the inner loop
194
             // each time through the inner loop
174
-        
195
+        }
175
         return w; // >= 3;
196
         return w; // >= 3;
176
     }
197
     }
177
 
198
 
184
         int runningScore = 0;
205
         int runningScore = 0;
185
 
206
 
186
         // do your while loop here
207
         // do your while loop here
187
-
188
-            // calling
208
+        do { runningScore = currentScore + runningScore;
189
             w = w + 1;
209
             w = w + 1;
210
+            currentScore = gameNextScore();
211
+            
212
+            // calling
213
+            
214
+        } while ( runningScore < highestScore );
190
             // each time through the inner loop
215
             // each time through the inner loop
191
 
216
 
192
         return w >= 3;
217
         return w >= 3;
200
         int w = 0;
225
         int w = 0;
201
         String adminPhoneNumber = "+1 202 456 1111";
226
         String adminPhoneNumber = "+1 202 456 1111";
202
         
227
         
228
+        while (serverIsRunning() == true) {
229
+            waitFor(5);
230
+            w = w + 1;
231
+        }
232
+        if (serverIsRunning() == false) {
233
+            sendEmergencyText("Help!", adminPhoneNumber);
234
+            tryServerRestart("Help!", adminPhoneNumber);
235
+        }
203
 
236
 
204
         // calling
237
         // calling
205
-        w = w + 1;
238
+
206
         // each time through the inner loop
239
         // each time through the inner loop
207
         
240
         
208
         return w;
241
         return w;