Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Java (help)

Name: Anonymous 2006-04-04 19:36

You are to create two classes to implement a database program.  The main class is a menu of options and will create an arraylist() to store the objects.  The other object contains the data that will be stored in the array list


Data Class

You are to create a class that implements the comparable interface and stores data.  It is similar to the contact method in the book.  It should have the following methods:
-    A constructor method
-    A get() and set() for each data element
-    String toString()
-    int compareto(object)

For example, if the class was a ASU_student, you might have a student id, first and last names, and a debt.  Then you would have:
-    void ASU_student( id, first, last, debt)
-    String getid(), String getfirst(), String getlast(), double getdebt()
-    void setid( id), void setfirst( first), void setlast( last), void setdebt( debt)
-    String toString()
-    int compareto( obj);


Main Class

In this class, you will create an arraylist to store objects of the above Data Class.  This class will prompt the user, via a menu, to perform the following operations, until the user decides to quit.

1.    Add an object to the list – the object should be unique.  Thus, you will need to search the list before adding to make sure the Key is not already there.  The key can be any data item (ex. student id), or combination of data items (Band + CD).
2.    Display an object from the list.  Ask for the key, search, and display all the data for the object, or that it was not found
3.    Remove an object from the list.  Ask for the key, search, and if there remove it.
4.    Modify an object from the list.  Ask for the key, search, and update the non-key fields.
5.    Scan the database for some sub-information, or non-key fields.  For example, you may want to display all records with a certain last name, or CD name, or range of GPA, ...


As Extra Credit, try reading in the database from a text file when the program starts, and saving it to a text file as the program exits.

Look at the book examples and the on-line documentation to see how an arraylist is used.

Name: Anonymous 2006-11-19 15:33

Okay, so someone is being held over a pit of lava and we have to cool off the lava before we get him loose. Okay! Let's call on Iceman!
Hmm? No? Iceman's powers have no effect on lava? Oh well, I guess we'll have to find a cauldron to pour on the lava! Okay, Iceman, you're off the hook, lukewarm water has saved the day!
The same applies to when you find someone trapped in a block of ice - can the Human Torch or Ghost Rider melt it? No. But you know what can? THE INDIRECT RAYS OF THE SUN.
The logic, it breaks. There's even a part of the game where they say "USE SOMEONE'S LIGHTNING POWERS" and when you do, it works. Simple as that. So why not make ice powers, you know, have icy effects?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List