Beispiel #1
0
        static void Main(string[] args)
        {
            DVD  DVDItem  = new DVD("Visual Studio 2019", DVDType.SOFTWARE, 999.99);
            VHS  VHSItem  = new VHS("Super Mario", 49.99);
            Book BookItem = new Book("Clean Code", 199.99);

            Console.WriteLine(DVDItem.ToString());
            Console.WriteLine(VHSItem.ToString());
            Console.WriteLine(BookItem.ToString());
            RentVisitor visitor = new RentVisitor();

            Cart itemCart = new Cart();

            itemCart.AddItem(DVDItem);
            itemCart.AddItem(VHSItem);
            itemCart.AddItem(BookItem);
            Console.WriteLine("Total price: " + itemCart.Accept(visitor));
            Console.ReadLine();
        }
Beispiel #2
0
 public double Visit(VHS VHSItem)
 {
     return(VHSItem.Price * (1 + VHSTax));
 }
Beispiel #3
0
 public double Visit(VHS VHSItem)
 {
     return(VHSItem.Price * rentingPercentage);
 }