Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/main/java/com/zipcodewilmington/PersonHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class PersonHandler {
private final Person[] personArray;

public PersonHandler(Person[] personArray) {

this.personArray = personArray;
}

Expand All @@ -15,6 +16,14 @@ public String whileLoop() {
// create a `counter`
// while `counter` is less than length of array
// begin loop
int count = 0;
while(count < personArray.length)
{
result = result.concat(personArray[count].toString());
count ++;

}


// use `counter` to identify the `current Person` in the array
// get `string Representation` of `currentPerson`
Expand All @@ -31,7 +40,9 @@ public String forLoop() {
// identify initial value
// identify terminal condition
// identify increment

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

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