Back to 211 Main Page

Mobius strip

Assignment 6

The Assignment

http://www2.hawaii.edu/~tp_200/ics211/fall2003/A6-hashtable.htm

Comments

You don't need to download any files to do this assignment. You will write all three of the specified .java files.

Car.java is simply a data structure. It should have three fields (instance variables)--the model, the year, and the serial number. There should be a get and set method for each of these three fields. You need a constructor that takes the 3 values stored in a Car. (You will also need a constructor that takes only the serial number.)

Since there are restrictions on the allowable values for Car details, you will need to throw an exception if the parameter given is out of that range. You can do this checking in your set methods. Then you can use your set methods from your constructor.

CarInventory.java is a hashtable that only works with Cars. Note that it does not actually take Car objects. So for your addCar, removeCar, and viewCar methods, you'll need to create a Car object to put into the hash table or to use as a key to find a Car already in the table.

CarInventory is the only class you will write that uses Nodes or SortedLists. You can either use Nodes to implement your hash table, or you can reuse your SortedList code. (You don't have to modify SortedList at all to do this.)

According to the specifications, removeCar and viewCar return null if the requested Car cannot be found. You can do it this way, or you can throw an exception if the Car cannot be found.

CarApplet.java will provide the GUI. It will have a CarInventory object as an instance variable.


Please name your methods exactly as specified. Remember Java is case-sensitive. As always, you can write more methods in addition to those specified.

When you submit your assignment, tell me which browser worked for you. By default, I will use appletviewer for Java 1.2.2. You can use this java version-checking applet to find out what Java Runtime Environment your current browser is using.

Grading

This assignment will be out of 10 points. You will get points for the following:

1.5 - Compiles
Your submitted program compiles and runs without error
1.0 - Complete submission
In your email, include a full link (http://...) to a working version of the applet on the web. Attach all your source code (.java files). You can reuse any of your previous code or any of the code I provided for previous assignments. But still send me all the files needed to run your program. This includes the .html file.
1.5 - Good documentation
See this note on documenting your code.
0.5 - Follows ICS coding standards
Use descriptive variable names, use internal capitalization for names, consistently indent and space code, etc.
1.5 - Car
Includes at least:
  • get and set methods for the three specified fields
  • toString method
  • equals method that only compares Cars based on serial number
2.5 - CarInventory
Includes the 6 methods specified on the assignment webpage. Uses a hashtable to store the passed information.
1.5 - Applet interface
Your applet should allow a user to add, remove, and find a car at a time. They should also be able to view all the cars currently in the inventory. Buttons should be disabled in contexts when they cannot be used. You should report any errors you encounter back to the user.


~ztomasze Index : TA Details: ICS211: Assignment 6
http://www2.hawaii.edu/~ztomasze
Last Edited: 05 Dec 2003
©2002 by Z. Tomaszewski.