i hope you can solve this problem during 1 hour.:P

Answer all of the following questions.

a. Create a Student class that has:
i. Two instance variables, name and id.
ii. Two constructors with the following headers :
public Student(int id, String name)
public Student(int id)
iii. Two get (accessor) methods for the two instance variables.
iv. An appropriate toString method
v. A compareTo method with the following header:
protected int compareTo(Comparable object)
that does the comparison based on student id’s.

b. Write a class, MatchingVisitor, whose constructor takes an instance of Comparable (target) as argument and finds whether the target exists in the container. Your visitor should have two additional methods as described below:
public boolean isFound() : returns true if a match is found, false otherwise.
public Comparable getMatch() : returns the reference to the matched object if found, null otherwise.
Note: Your visitor must stop the search as soon as it finds a match.

c. Write a menu-driven application that makes use of the Container and PrintingVisitor classes of lab01, the Student and the MatchingVisitor classes described above to maintain a record of students.
You application should have at least the following options:
Add a student Reads a student information from the user and adds it to the container.
Find a student Reads a student id from the user and finds if it exists in the container using the MatchingVisitor. If found, the full detail of the student should be displayed, otherwise an appropriate message is displayed.
List all students Prints all students in the container using a printing visitor
Exit Exit the application.

thanks,alot...

Even though I got a two-word easy answer for you, I am not writing it here to show respect to the board regulation.
I can say only two things to you:
1) If you think you are such a smart that you can make other people to do your homework, then I will say you are sleeping. Wake up and start working.
2) No one will answer any of your questions. Yes, most of us are professionals, but it is not out job to solve your problem. It doesn't matter if it takes "1 hour" or 2 min. Just don't be jerk!

Good luck!

Comments
I cannot understand what he is saying
Good response

NO..NO..NO..ORKO :icon_surprised:
u have to understand that, i have solved this problem tow days ago during 53 min.
and i also want to say tow things:
1)I WILL POST MY SOLUTION TOMORROW IF U WANT.
2)AND MY MAIN AIMS WERE TO KNOW MY ACTUAL LEVEL , AND IF THERE ARE DIFFERENT IDEAS TO SOLVE THIS Q.

*AND I WANT U TO KNOW SOME THING WE ARE HERE FOR THE SAME AIM WHICH IS "LEARNING"..ALSO DO NOT THINK U ARE THE SMARTEST PERSON IN THE WORLD MY FRIEND. :cool:

i am waiting for ur solution max. until 8 a.m. ..after 6 hours,else i will post the solution..ok orko?

For all we know you could be lying about being able to solve the problem so that we would give you the solution. A lot of teenagers come through here trying to get us to cheat for them.

so my friend tell me..what is the benefit of the website and also u if u did not work and help people..and i do not your roles if they do not help the other??

thanx

We don't mind helping people but some of them come here, give us a problem, and tell us to solve it for them. Your original post sounded just like that.

first001, I never said I am even a smart one. I try my best to help some one in my free times if I know the answer. I neither have any intention to compete with you nor interested to see your solution for the problems.
See your thread title and the questions you have posted. They clearly have no relation with database and you are asking database professionals to solve them. I don't think you even have any idea what database is. You are funny and disrespectful. A small kid may bit you in programming; yet deserves respect from you. Thanks god I am one of the younger ones here. There are a lot of senior programmers with huge knowledge. I am feeling awkward how they will feel after reading this challenge from someone who just knows how to create a simple class with simple gui.

Thanks jasimp for clearing this out.

This article has been dead for over six months. Start a new discussion instead.