/** An instance describes a chapter in a book * */
public class Chapter {
    private String title; // The title of the chapter
    private int number; // The number of chapter
    private Chapter previous; // previous chapter (null if none)
    
    /** Constructor: an instance with title t, chap n, previous chap c */
    public Chapter(String t, int n, Chapter c) {
        title= t;
        number= n;
        previous= c; 
    }
    
    /** Constructor: an instance with title "", chapter 0, and
        previous chapter null */
    public Chapter() {
        title= "";
        number= 0;
        previous= null; 
    }
    
    // Getter methods
    
    /** = title of this chapter */
    public String getTitle() { 
        return title; 
    }
    
    /** = number of this chapter */
    public int getNumber() { 
        return number; 
    }
    
    /** = (name of) the previous chapter (null if none) */
    public Chapter getPrevious() { 
        return previous; 
    }
    
    // Setter methods
    
    /** Set the title of this chapter to t */
    public void getTitle(String t) { 
        title= t; 
    }
    
    /** set the number of this chapter to n */
    public void getNumber(int n) { 
        number= n; 
    }
    
    /** Make p the previous chapter (p can be null) */
    public void getPrevious(Chapter p) { 
        previous= p; 
    }
    
    
    // OTHER METHODS
    
    /** = the chapter number of Chapter c.
          Precondition: c should not be null */
    public int chapterNumber(Chapter c) {
        return 0; // Fix this
    }
    
   
    /** = Òc is not null and has chapter number 0Ó */
    public static boolean isZero(Chapter c) {
        return c != null && c.number == 0; // fix this
    }
    
    /** = ÒThis chapter has a lower chapter
          number than Chapter cÓ.
          Precondition: c is not null. */
    public  boolean isLower(Chapter c) {
        return number < c.number;
    }
    
    /** = ÒbÕs chapter number is lower than
          cÕs chapter numberÓ.
         Precondition: b and c are not null. */
    public static boolean isLower(Chapter b, Chapter c) {
        return b.number < c.number;
    }
    
    
}