Home Segments Top Top Previous Next

299: Mainline

You should avoid duplication, however, even in simple methods—and the Movie and Symphony constructors shown in Segment 298 are duplicates.

Fortunately, you have already defined a suitable one-argument, minutes-assigning constructor in the Attraction class:

public class Attraction {
 private int minutes;
 public int getMinutes() {return minutes;}
 public void setMinutes(int m) {minutes = m;}
 public Attraction () {minutes = 75;}
 public Attraction (int m) {minutes = m;} 
}