/* * Main method where some example scanned items are added and the discounted * total is calculated and displayed. */ static void Main(string[] args) { Checkout checkout = new Checkout(); ScannedItem item1 = new ScannedItem("A99", 0.5f, 3, 1.30f); ScannedItem item2 = new ScannedItem("B15", 0.3f, 2, 0.45f); ScannedItem item3 = new ScannedItem("A99", 0.5f, 3, 1.30f); ScannedItem item4 = new ScannedItem("A99", 0.5f, 3, 1.30f); ScannedItem item5 = new ScannedItem("B15", 0.3f, 2, 0.45f); checkout.Scan(item1); checkout.Scan(item2); checkout.Scan(item3); checkout.Scan(item4); checkout.Scan(item5); Console.WriteLine("Discounted total: " + checkout.GetDiscountedTotal() + "\n"); }
/* * Adds item to scanned items list. */ public void Scan(ScannedItem item) { // Add item to scanned items scannedItems.Add(item); }