Thursday, October 15, 2009

Homework 6: Media Library


For this homework you will implement a series of Java classes which are meant to be at the heart of a media library program (like iTunes). The diagram above is a UML diagram. Your textbook explains these diagrams in detail starting in page 559. You will implement all the classes described in the above diagram along with their respective attributes and methods
There are some some further requirements:
  1. Each of the leaf classes must implement a toString that adds all the information particular to that class to the string, and that calls the parent toString method to get the common parts. For example, only movies have a rating but all media has a title.
  2. Every class should have two constructors (these are not shown in the UML diagram): one that takes no arguments and sets values to the empty string, 0, or equivalent, and one that takes all the arguments for that class. Constructors should call the parent constructor when appropriate.
  3. The movie ratings are only one of:G, PG, PG-13, R, NC-17, X. You must implement set/get methods to ensure no one can set the rating to something else.
  4. The equals method in Media only test that the titles are the same, but the one in Song also tests that the artists are the same.
  5. You must also write a main method that tests all your classes and their methods.
This homework is due by noon on Thursday, October 22.

No comments: