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); } public string Statement { get { double totalAmount = 0.0; int frequentRenterPoints = 0; string result = "Rental Record for " + Name + "\r\n"; foreach(Rental rental in rentals) { frequentRenterPoints += rental.FrequentRenterPoints; result += "\t" + rental.Movie.Title + "\t" + rental.Charge.ToString() + "\r\n"; totalAmount += rental.Charge; } result += "Amount owed is " + totalAmount + "\r\n"; result += "You earned " + frequentRenterPoints + " frequent renter points"; return result; } } } }