using System; namespace BlockBuster { public class Rental { public Rental(Movie movie, int daysRented) { this.movie = movie; this.daysRented = daysRented; } private Movie movie; public Movie Movie { get { return movie; } } private int daysRented; public int DaysRented { get { return daysRented; } } public double Charge { get { double result = 0; switch(Movie.PriceCode) { case MoviePriceCode.Regular: result += 2; if(DaysRented > 2) result += (DaysRented - 2) * 1.5; break; case MoviePriceCode.NewRelease: result += DaysRented * 3; break; case MoviePriceCode.Childrens: result += 1.5; if(DaysRented > 3) result += (DaysRented - 3) * 1.5; break; } return result; } } public int FrequentRenterPoints { get { if(Movie.PriceCode == MoviePriceCode.NewRelease && DaysRented > 1) return 2; else return 1; } } } }