public static void CallHistorySimulation() { GSM htcMini = new GSM("One mini", "HTC", 400, "Ivan", new Battery(BatteryType.LiPol, null, 400, 60), new Display(4.3, "16M")); htcMini.AddCall(DateTime.Today, DateTime.Today.AddMinutes(10), "1234567890"); htcMini.AddCall(DateTime.Today, DateTime.Today.AddMinutes(20), "1234567890"); htcMini.AddCall(DateTime.Today, DateTime.Today.AddSeconds(10), "1234567890"); htcMini.AddCall(DateTime.Today, DateTime.Today.AddSeconds(0), "1234567890"); htcMini.AddCall(DateTime.Today, DateTime.Today.AddSeconds(48), "1234567890"); Console.WriteLine("Call history\n"); Console.WriteLine(htcMini); Console.WriteLine("Total price: {0:F2}\n", htcMini.TotalAmountOfCalls(0.37)); htcMini.DeleteLongestCall(); Console.WriteLine("After remove longest call\n"); Console.WriteLine(htcMini); Console.WriteLine("Total price: {0:F2}\n", htcMini.TotalAmountOfCalls(0.37)); Console.WriteLine("After clear call history\n"); htcMini.DeleteAllCalls(); Console.WriteLine(htcMini); }
public static void TestCalls() { GSM gsm = new GSM("Galaxy S", "Samsung", 500, "Peter", new Battery("GalaxyS Battery", 200, 30, BatteryType.LiIon), new Display(4.0, 65000)); decimal price = 0.37M; Console.WriteLine("Adding calls..."); AddCalls(gsm); Console.WriteLine("Dislaying calls: "); Console.WriteLine(); DisplayCalls(gsm); Console.WriteLine(); Console.WriteLine("Total price of calls: {0}", CalculatePrice(gsm, price)); RemoveLongestCall(gsm); Console.WriteLine("Price without the longest call: {0}", CalculatePrice(gsm, price)); gsm.DeleteAllCalls(); Console.WriteLine("Dislaying calls after removal: "); DisplayCalls(gsm); }