This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hash Table, Hash Map, Linked List of objects Please, I need some help with the following project. Deadline is only next week friday 28th:
You are required to implement a flight reservation system. Firstly, create a class which will hold the details of a flight. This should include a flight number, departure and arrival cities and the date of departure. You should use all techniques of Object Oriented Design (such as encapsulation) with which you are familiar. Next, create a class which holds the passenger information. This should contain the name, e-mail address, and flight number for the passenger.
Now create a main application. You should create a three-cell hash table, where each cell is the head of a linked list. Add 5 flight objects to this table; the key being the flight number. Note that the flight number should consist of two letters followed by a three digit number. You may either ask the user to input the 5 flights, or read them in from a file; both are equally difficult. You should check to ensure that the flight number conforms to this standard. Your main application should create a tree (you may use the attached code). Allow the user to do the following:
1.Add a passenger to a given flight. This should cause the passenger to be inserted into the correct location in the tree. You may determine the correct location in the tree based on passenger name. 2.remove a passenger from a given flight. This should cause the correct rearrangement of the tree. 3.print out the passengers in alphabetical order. You might consider using a toString() method as part of the passenger class.
When taking in the passenger details, you should perform some checking. 1.A passenger may not be added to a flight that does not already exist. 2.a maximum of 5 passengers may be booked onto each flight 3.be creative and check other things as well.
In the project be sure to use the precepts of Object-oriented design. It is not enough to get the program working. Marks will be deducted for badly presented code or bad design. Note that the passenger and flight details are totally separate. The hash-table of flights is used to store flights and to look them up (thereby verifying the flight exists). The tree of passengers is used to store passengers only.
I am just confused with Has tables, linked list and the stuff, and hence this assignment:
Well, I am assuming that you were just taught Hash Tables and Linked Lists, and now have an assignment that you are suppose to use it on. However, instead of using the assignment as a "trial by fire", I think it would be better to address your confusion about Hashtables and Linked Lists, before doing the assignment.
So... what specifically are you confused about? Is it a particular issue with using the Hashtable and LinkedList classes? Using them in a particular way? Or are you confused at the concept level? etc.
I don't think your response is in anyway helpful. I just need someone who really understand the assignment, help me do it and I will be able to understand from the done assignment. Can you actually help me in that way?
Originally posted by amofa baffoe: I just need someone who really understand the assignment, help me do it and I will be able to understand from the done assignment.
So the best way to help you is to do the assignment for you, so that you can try to understand the "done" assignment?
There is no emoticon for what I am feeling!
Joined: Mar 31, 2006
Joined: Sep 16, 2005
Originally posted by amofa baffoe: yes
At the risk of feeding a troll, that's not the way JavaRanch works. It's up to you to put in the initial effort. The classes you posted were just examples of simple beans, with getters and setters -- there was no sign of hashing or hash tables or maps. If you are completely lost, this isn't the way to proceed. You need to start by studying. Have you read a tutorial : http://java.sun.com/docs/books/tutorial/collections/index.html, and have you tried to ask your instructor questions? [ April 21, 2006: Message edited by: Jeff Albertson ]
Joined: Mar 31, 2006
don't worry, there are a lot of forums out there
Joined: Sep 16, 2005
Originally posted by amofa baffoe: don't worry, there are a lot of forums out there
Let me suggest The Java Forums at Sun. They're smarter than us and should be able to code up your assignment in no time.
author and iconoclast