Skip to content

I've finished this lab #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
21 changes: 19 additions & 2 deletions src/main/java/com/zipcodewilmington/PersonHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,29 @@ public PersonHandler(Person[] personArray) {

public String whileLoop() {
String result = "";
int x = 0;
// create a `counter`
// while `counter` is less than length of array
// begin loop

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

// end loop

while(x < personArray.length) {
String currentPerson = personArray[x].toString();
result += currentPerson;
x ++;
}
return result;
}



public String forLoop() {
String result = "";
int x = 0;

// identify initial value
// identify terminal condition
// identify increment
Expand All @@ -38,6 +45,11 @@ public String forLoop() {
// get `string Representation` of `currentPerson`
// append `stringRepresentation` to `result` variable
// end loop
for(int i = 0; i < personArray.length; i++){
String currentPerson = personArray[x].toString();
result += currentPerson;
x ++;
}

return result;
}
Expand All @@ -55,6 +67,11 @@ public String forEachLoop() {
// append `stringRepresentation` to `result` variable
// end loop

for(Person person : personArray){
String currentPerson = person.toString();
result += currentPerson;
}

return result;
}

Expand Down