public class Movie { public static final int REGULAR = 0; public static final int NEW_RELEASE = 1; public static final int CHILDRENS = 2; private String title; private Category priceCode; public Movie( String title, int priceCode ) { this.title = title; setPriceCode( priceCode ); } public int priceCode() { return priceCode.priceCode(); } public void setPriceCode( int p ) { switch ( p ) { case Movie.REGULAR: priceCode = new RegularCategory(); break; case Movie.NEW_RELEASE: priceCode = new NewReleaseCategory(); break; case Movie.CHILDRENS: priceCode = new ChildrensCategory(); break; } } public String title() { return title; } public double price( int daysRented ) { return priceCode.price( daysRented ); } }