|
-
Nov 12th, 2003, 06:37 PM
#1
Thread Starter
PowerPoster
not showing the last record
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.
Code:
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
[edit] it also happens for some other objects now [/edit]
Last edited by Techno; Nov 12th, 2003 at 07:52 PM.
-
Nov 13th, 2003, 06:49 AM
#2
I don't see a problem with this snippet.
But VC++ is not a language.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|