using System; using System.Collections; namespace BlockBuster { public class Customer { public Customer(string name) { this.name = name; } private string name; public string Name { get { return name; } } private ArrayList rentals = new ArrayList(); public void AddRental(Rental rental) { rentals.Add(rental); } private double AmountFor(Rental rental) { return rental.Charge; } public string Statement { get { double totalAmount = 0.0; int frequentRenterPoints = 0; string result = "Rental Record for " + Name + "\r\n"; foreach(Rental rental in rentals) { double thisAmount = 0.0; thisAmount = AmountFor(rental); frequentRenterPoints++; if(rental.Movie.PriceCode == MoviePriceCode.NewRelease && rental.DaysRented > 1) frequentRenterPoints++; result += "\t" + rental.Movie.Title + "\t" + thisAmount.ToString() + "\r\n"; totalAmount += thisAmount; } result += "Amount owed is " + totalAmount + "\r\n"; result += "You earned " + frequentRenterPoints + " frequent renter points"; return result; } } } }