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

Lab 2

1 Lab Objectives

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

2 Design and Implementation Problem

This week, we take a fresh look at the ITunes example from last week. Now 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.

  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 podcasts) into your class hierarchy. What in your code indicates that songs and podcasts are in this category? How did you require that they 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.

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

3 What to Turn in

Submit all .java files that you produced for this assignment to the Lab1 area via Turnin. If you don’t have a Turnin account or don’t find CS2102 under your available courses, ask your lab staff to create one for you.