コード例 #1
0
        static void Main(string[] args)
        {
            // Create movies
            Movie movCinderella = new Movie("Cinderella", PriceCodes.Childrens);
            Movie movStarWars = new Movie("Star Wars", PriceCodes.Regular);
            Movie movGladiator = new Movie("Gladiator", PriceCodes.NewRelease);

            // Create customers
            Customer custMickeyMouse = new Customer("Mickey Mouse");
            Customer custDonaldDuck = new Customer("Donald Duck");
            Customer custMinnieMouse = new Customer("Minnie Mouse");

            // Create rentals
            Rental rental1 = new Rental(movCinderella, 5);
            Rental rental2 = new Rental(movStarWars, 5);
            Rental rental3 = new Rental(movGladiator, 5);

            // Assign rentals to customers
            custMickeyMouse.AddRental(rental1);
            custMickeyMouse.AddRental(rental2);
            custMickeyMouse.AddRental(rental3);

            // Generate invoice
            string statement = custMickeyMouse.Statement();

            // Print the statement
            Console.WriteLine(statement);
            Console.ReadLine();
        }
コード例 #2
0
        public void Init()
        {
            // Create movies
            m_Cinderella = new Movie("Cinderella", PriceCodes.Childrens);
            m_StarWars = new Movie("Star Wars", PriceCodes.Regular);
            m_Gladiator = new Movie("Gladiator", PriceCodes.NewRelease);

            // Create rentals
            m_Rental1 = new Rental(m_Cinderella, 5);
            m_Rental2 = new Rental(m_StarWars, 5);
            m_Rental3 = new Rental(m_Gladiator, 5);

            // Create customers
            m_MickeyMouse = new Customer("Mickey Mouse");
            m_DonaldDuck = new Customer("Donald Duck");
            m_MinnieMouse = new Customer("Minnie Mouse");
        }
コード例 #3
0
 /* Constructor */
 public Rental(Movie movie, int daysRented)
 {
     m_Movie = movie;
     m_DaysRented = daysRented;
 }