To: The Summer 1998 CS 299 -Programming in Java- Class
From: Clifton, Scanlan
Date: June 23, 1998
RE: Program 4
Due Date: June 30, 1998
Grace Date: July 2, 1998 - Demo'ed before the end of class period.
Points: 25

1. Make a TPerson class. You are required to have three private fields: one for first name, one for last name, and one for Social Security Number. Make appropriate constructors, have appropriate get and set methods, and override the inherited (from Object) toString method.

2. Make a TPersonList class. The private data should be an array of TPerson. Assume at most 100 persons in the list. Have methods to:

  • a) Add a person to the list.
  • b) Sort the list by last name.
  • c) Sort the list by Social Security Number.
  • d) Return the number people in the list.
  • e) Return the nth person in the list. (return null if there isn't one)

    Note that I am not requiring a method to Remove a person from the list.

    3. Make an applet that has:
  • a) Textfields for the first name, last name, and Social Security Number.
  • b) An "Add to List" button that adds a person to the person list whose name an SSN are given by the current data in the Text fieldsDisplay an appropriate error message if all the Textfields don't contain appropriate data - SSN must be 9 digits.
  • c) A "Sort by Name" button and "Sort by Social Security Number" button that do the obvious things when they are clicked
  • d) A Text Area that always displays the current contents of the list.
  • Hint: The paint method will display the list. Whenever changes are made, call repaint().
  • e) Appropriate labels for all of the above.

    If you have an questions or ambiguities, ask ME!

    (Recall that Exam 2 will be Wednesday, July 1)