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-04-07 22:40

>>18

In a few years, you'll realised that >>1 will turn out to be your co-worker or new manager, and that somehow got a BSc Degree and knows shit little about basic programming.

I'm sure you'll be ESCATIC to find out that you helped someone who can't even implement a simple OO Object defination get that degree.

We, people who perhaps code for a living, on a whole, thank you for putting cut and paste "coders" through university.

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