static void Main(string[] args) { CashRegister cr1 = new CashRegister(); Console.WriteLine($"Adding an item worth 2.70 to Cash Register 1"); Console.WriteLine($"Adding an item worth 3.45 to Cash Register 1"); Console.WriteLine($"Adding an item worth 5.97 to Cash Register 1"); cr1.AddItem(2.70); cr1.AddItem(3.45); cr1.AddItem(5.97); CashRegister cr2 = new CashRegister(); Console.WriteLine($"Adding an item worth 12.52 to Cash Register 2"); Console.WriteLine($"Adding an item worth 1.43 to Cash Register 2"); Console.WriteLine($"Adding an item worth 15.57 to Cash Register 2"); Console.WriteLine($"Adding an item worth 5.15 to Cash Register 2"); cr2.AddItem(12.52); cr2.AddItem(1.43); cr2.AddItem(15.57); cr2.AddItem(5.15); Console.WriteLine("Cash Register CR1 Total: {0}", cr1.Total); Console.WriteLine("Cash Register CR1 Number of Items: {0}", cr1.NumberOfItems); Console.WriteLine("Cash Register CR2 Total: {0}", cr2.Total); Console.WriteLine("Cash Register CR2 Number of Items: {0}", cr2.NumberOfItems); }
static void Main(string[] args) { CashRegister register1 = new CashRegister("CR1"); CashRegister register2 = new CashRegister(); register1.AddItem(58.5); register1.AddItem(5.9); register1.AddItem(5.5); register1.AddItem(18); register1.AddItem(5.59); register2.AddItem(52.5); register2.AddItem(15.5); register2.AddItem(53.5); register2.AddItem(544.5); Console.WriteLine(); PrintReport(register1); Console.WriteLine(); register2.Name = "CR2"; PrintReport(register2); Console.ReadLine(); }
static void Main(string[] args) { CashRegister cr1 = new CashRegister(); Console.WriteLine("Adding a total of 2.70 to cash register 1"); Console.WriteLine("Adding a total of 3.45 to cash register 1"); Console.WriteLine("Adding a total of 1.43 to cash register 1"); Console.WriteLine("Adding a total of 5.97 to cash register 1"); Console.WriteLine("Adding a total of 12.52 to cash register 1"); cr1.AddItem(2.70); cr1.AddItem(3.45); cr1.AddItem(1.43); cr1.AddItem(5.97); cr1.AddItem(12.52); CashRegister cr2 = new CashRegister(); Console.WriteLine("Adding a total of 4.70 to cash register 2"); Console.WriteLine("Adding a total of 7.45 to cash register 2"); Console.WriteLine("Adding a total of 1.43 to cash register 2"); Console.WriteLine("Adding a total of 3.97 to cash register 2"); Console.WriteLine("Adding a total of 13.52 to cash register 2"); cr2.AddItem(4.70); cr2.AddItem(7.45); cr2.AddItem(1.43); cr2.AddItem(3.97); cr2.AddItem(13.52); Console.WriteLine("Cash Register Cr1 Total >> {0}", cr1.total); Console.WriteLine("Cash Register Cr1 Number of items >> {0}", cr1.numberOfItems); Console.WriteLine("Cash Register Cr2 Total >> {0}", cr2.total); Console.WriteLine("Cash Register Cr2 Number of items >> {0}", cr2.numberOfItems); }
private static void PrintReport(CashRegister register) { Console.WriteLine("Total cash in {0} is: {1} ", register.Name, register.GetTotalCash()); Console.WriteLine("Total Items count in {0} is: {1} ", register.Name, register.GetTotalItems()); }