Home Segments Top Top Previous Next

765: Mainline

Following a principle of good programming practice, the Movie class definition implements the MovieInterface interface, which insists on the definition of various setters and getters, as well as the rating method, which is intended to compute an overall rating from the script, acting, and direction values, and the changed method, about which you learn in Segment 767.

public interface MovieInterface { 
 // Getters 
 public abstract int getScript () ; 
 public abstract int getActing () ; 
 public abstract int getDirection () ; 
 public abstract String getTitle () ; 
 public abstract String getPoster () ; 
 // Setters 
 public abstract void setScript (int i) ; 
 public abstract void setActing (int i) ; 
 public abstract void setDirection (int i) ; 
 // Miscellaneous methods 
 public abstract int rating () ; 
 public abstract void changed () ; 
}  

There are no setters corresponding to getTitle and getPoster, because the title and poster are presumed to be set, once and for all, by a constructor.