Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/main/java/com/zipcodewilmington/PersonHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ public PersonHandler(Person[] personArray) {
public String whileLoop() {
String result = "";
// create a `counter`
int counter = 0;
// while `counter` is less than length of array
while (counter< this.personArray.length) {
// begin loop

// use `counter` to identify the `current Person` in the array
// get `string Representation` of `currentPerson`
// append `stringRepresentation` to `result` variable

// use `counter` to identify the `current Person` in the array
// get `string Representation` of `currentPerson`
// append `stringRepresentation` to `result` variable
result = result + this.personArray[counter++].toString();
// end loop
}
return result;
}

Expand All @@ -31,7 +33,9 @@ public String forLoop() {
// identify initial value
// identify terminal condition
// identify increment

for(int counter = 0; counter < this.personArray.length; counter++){
result = result + this.personArray[counter].toString();
}
// use the above clauses to declare for-loop signature
// begin loop
// use `counter` to identify the `current Person` in the array
Expand All @@ -50,6 +54,9 @@ public String forEachLoop() {
// identify array's variable-name

// use the above discoveries to declare for-each-loop signature
for( Person person: this.personArray){
result = result + person.toString();
}
// begin loop
// get `string Representation` of `currentPerson`
// append `stringRepresentation` to `result` variable
Expand Down