| Java Programming Spring 2006 Homework #6 |
|   Course Syllabus   |   Java Programming Home   |   Assignment   |   Submitting |
Assignment
This assignment involves writing a java class that represents a CD (for use in a database of CDs). Your CD class must implement the interface shown below - the important part of this is that your object must be able to generate a window that allows the user to enter and/or change the CD information.
Here is the interface you must implement:
public interface CD {
public void setName(String s);
public String getName();
public void setArtist(String s);
public String getArtist();
public void setPublisher(String s);
public String getPublisher();
public void setNumTracks(int i);
public int getNumTracks();
public String toString();
public void edit();
}
You class that implements CD must be named
MyCD.
The toString method should return any printable
representation of the CD (a string that includes the CD name, artist,
publisher and # of tracks).
When the edit method should return (this should be
modal). Don't let your edit return right away,
otherwise the calling code wil assume the changes have already been made!
Do not assume that the calling program
contains any GUI code, your code should work with something as simple
as this:
MyCD foo = new MyCD(); foo.edit(); System.out.println(foo);
Once the user inidicates changes are complete, the edit method should return and the window must disappear.
Make sure the # tracks is a number, and if it is not you must not allow this to generate a stack trace (you need to catch any exception this could cause, and handle it yourself).
Make it look good (use some real layout managers!). It is not acceptable for you to submit something that makes no effort to make the GUI look nice. We will not define what nice means, all that matters is that you do take control of the appearance.
Something as simple as this is acceptable:
Submitting
Submit to WebCT dropbox for HW6. Make sure all your code is commented with JavaDoc comments!