Esempio n. 1
0
        static void Main(string[] args)
        {
            Invoice invoice = new Invoice { Customer = "Kirsi Kernell" };
            InvoiceItem milk = new InvoiceItem { Name = "Milk", Price = 2.50, Quantity = 2 };
            InvoiceItem bread = new InvoiceItem { Name = "Bread", Price = 1.90, Quantity = 1 };
            InvoiceItem eggs = new InvoiceItem { Name = "Eggs", Price = 1.50, Quantity = 2 };
            InvoiceItem spices = new InvoiceItem { Name = "Spices", Price = 4.50, Quantity = 1 };
            InvoiceItem butter = new InvoiceItem { Name = "Butter", Price = 2.20, Quantity = 2 };

            invoice.AddItem(milk);
            invoice.AddItem(bread);
            invoice.AddItem(eggs);
            invoice.AddItem(spices);
            invoice.AddItem(butter);

            Console.WriteLine(invoice.ToString());

        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            InvoiceItem i = new InvoiceItem();

            i.Name     = "Milk";
            i.Price    = 1.5;
            i.Quantity = 3;
            i.TotalPrice();
            Console.WriteLine(i.ToString());
            Console.WriteLine("====================================");

            InvoiceItem b = new InvoiceItem();

            b.Name     = "Beer";
            b.Price    = 1.2;
            b.Quantity = 12;
            b.TotalPrice();
            Console.WriteLine(b.ToString());
            Console.WriteLine("====================================");

            InvoiceItem d = new InvoiceItem();

            d.Name     = "Doritos";
            d.Price    = 1.9;
            d.Quantity = 1;
            d.TotalPrice();
            Console.WriteLine(d.ToString());

            Invoice i1 = new Invoice();

            i1.products.Add(i);
            i1.products.Add(b);
            i1.products.Add(d);

            i1.TotalInvoice();

            i1.PrintInvoice();
        }
Esempio n. 3
0
 public void AddItem(InvoiceItem item)
 {
     Items.Add(item);
 }