Magazine - }

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // Magazine.java Author: Lewis/Loftus // // Solution to Programming Project 12.2 // // Represents a single magazine. //******************************************************************** / public class Magazine implements Comparable { private String title; //----------------------------------------------------------------- // Sets up the new magazine with its title. //----------------------------------------------------------------- public Magazine (String newTitle) { title = newTitle;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } //-----------------------------------------------------------------// Returns this magazine as a string. //-----------------------------------------------------------------public String toString () { return title; } //-----------------------------------------------------------------// Implementation of the Comparable class method //-----------------------------------------------------------------public int compareTo(Object obj) { Magazine other = (Magazine)obj; return title.compareTo(other.title); } }...
View Full Document

Ask a homework question - tutors are online