PDA

Click to See Complete Forum and Search --> : not showing the last record


Techno
Nov 12th, 2003, 05:37 PM
can someone help? plz? :)

i dunno whats happening but this code is not working. lets say we create some objects, and 3 are java, 4 are of VC++ and 4 are of VB

"Luige", 102, 1000, 1969, "Java"
"Tiff", 171, 1000, 1978, "Java"
"Anne", 521, 1000, 1971, "Java"

"Steve", 123, 1000, 1985, "VB"
"Stuart", 345, 1000, 1983, "VB"
"Darren", 211, 1000, 1973, "VB"
"Euan", 133, 1000, 1975, "VB"

etc...

now i wanna make sure that i find the eldest person and that their prog lang matches the youngest (mentor mentee situation)


for some reason this doesnt work properly:-/ im using a Treeset here

problem is that if we try and assign a Mentee to Mentor (or other way around) it checks to see if there is an experienced programmer (by age) then goes and checks the programming language to see if they match the inexperienced one.

we dont know how the user is going to enter the data so it can be in any random order.


iter = theStaff.iterator();
while(iter.hasNext() == true)
{
Programmer mentor = (Programmer)iter.next();
mentorage = mentor.getAge();
getlang = mentor.getCertainLang();

//Find the eldest one in the employee
if(menteeage < mentorage)
{
if(getlang.equals(thisproglang) && foundpn == true)
{
details = mentor.toString();
foundMentor = true;
}
}
}


that is the main code for the problem

i cant seem to find the problem - plz help


it also happens for some other objects now :(

CornedBee
Nov 13th, 2003, 05:49 AM
I don't see a problem with this snippet.

But VC++ is not a language.