public class Chapter { /* Data members */ /** The title of the chapter */ private String title=""; /** The number of pages in the chapter */ private int numPages; /** Default constructor */ public Chapter(){ // nada } /** Specific Constructor */ public Chapter(String theTitle, int theNumPages){ setTitle(theTitle); setNumPages(theNumPages); } // Accessors and Mutators /** getTitle(): returns the title of the chapter */ public String getTitle(){ return title; } /** setTitle(): sets the title of the chapter */ public void setTitle(String theTitle){ title = theTitle; } /** Get the number of pages */ public int getNumPages(){ return numPages; } /** Set the number of pages */ public void setNumPages(int theNumPages){ if(theNumPages < 0) numPages=0; else numPages = theNumPages; } /** return a string representing the Chapter */ public String toString(){ String theResult = getTitle() + " (" + getNumPages() + " pages)"; return theResult; } }