There are some some further requirements:
- 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 parenttoString
method to get the common parts. For example, only movies have a rating but all media has a title. - 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.
- 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.
- The
equals
method inMedia
only test that the titles are the same, but the one inSong
also tests that the artists are the same. - You must also write a
main
method that tests all your classes and their methods.
No comments:
Post a Comment