I believe the problem is with your blocks unless if it was typo, try it this
way, the i++ should be within the while block:
int 0;
while (i<names.length){
if (names [i].equals(searchName)) {
foundName = true;
break;
}
i++;
}
--- On Wed, 7/22/09, David Seto <[email protected]> wrote:
From: David Seto <[email protected]>
Subject: [java programming] Lab 1034
To: [email protected]
Date: Wednesday, July 22, 2009, 11:04 AM
Hello all on lab 1034 homework assignment
When I run the program and type in the 1st name on the list “Beah” no problem.
Name found on the list and the program is finished.
When I rerun the program and type in the 2nd name on the list “Bianca” the
program gets stuck .
Here’s part of the program does it have to deal with the location of the i++?
int i = 0;
while (i<names.length)
if (names [i].equals(searchName)) {
foundName = true;
break;
}
{i++;
}
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---