1 Lab Objectives
2 Design and Implementation Problem
3 What to Turn in

Lab 1

1 Lab Objectives

  1. Re-iterate when to create each of interfaces and abstract classes when designing class hierarchies.

2 Design and Implementation Problem

Imagine you're writing software to manage a package like ITunes. Your software needs to manage three kinds of items, each of which has a title and a duration: songs, podcast episodes, and audio books. Despite these similarities, these items also have some differences:

Your task is to design a class hierarchy for Media Items that has all of the above features. You’ll do this with a combination of interfaces and abstract classes.

Develop your Examples class as you go to check that you understand the definitions you are creating.

You should organize your solution for this and all remaining labs and homeworks as a java project (each interface and class definition go into a separate file). If you are using DrJava, refer to the documentation on the project facility. The SAs can help you if you have any questions.

  1. Create an interface for media items. Create classes for each of songs, podcast eipsodes, and audio books that implement this interface.

  2. Create classes for albums and podcasts, with the fields as described above.

  3. Introduce the notion of an item in a collection (ie, songs and podcast episodes) into your class hierarchy. What in your code indicates that songs and podcasts are in this category? How did you require that each item in a collection contains a way to access the information about that collection?

  4. Similarly, add a notion of categorizable to your class hierarchy and apply it to songs and podcasts. You should be able to answer the same questions as when you added collections.

  5. Now add a notion of published for Albums and Audio Books, answering the same questions about required components.

3 What to Turn in

Submit all .java source files that you produced for this assignment to Lab 1 via Turnin (in DrJava, under Project, choose "Create Jar file from Project", and in the next window check the option that creates the .jar file from the java source files). See you next week!