CD Class
This a class that models a CD and should implement the Media interface.
- Instance variables: Declare four instance variables -- id (Integer), artist (String), title (String), and year (int). Notice the data type of id is an Integer and not an int. Make sure you do not use the basic int data type for the id as we will be calling the Comparable interface's compareTo() method on it.
- Constructor: Take in four arguments for an id, artist, a title, and a year and assign these values to their associated instance variables.
- Methods: Implement the four Media interface methods by returning the proper corresponding instance variable.
The getId() method: Make sure you typecast the returning id as follows:
public <T> Comparable<T> getId() { return (Comparable<T>) id; }