/* Written by Jacob Pavlovec - 11/5/07 This class represents a generic song. It implements Comparable so that it can by sorted by the sort method of the Arrays class */ public class Song implements Comparable { String name; String artist; int year; public Song(String name, String artist, int year) { this.name = name; this.artist = artist; this.year = year; } /* Because this class implements Comparable, this method must be included. I have set this method up so that the songs can be sorted by date. Can you change this method so it can be sorted by author? */ public int compareTo(Object o) { Song s = (Song)o; return s.year - this.year; } public String toString() { return name + " : " + artist + " : " + year; } }