private static void CallTest() { GSM testGSM = new GSM("Nokia", "Lumia", 400, "Nikoi", new Battery("0093/478AS/9IOF1", 240, 17, BatteryType.NiCd), new Display(6.3, 16)); testGSM.AddCall("12.04.2014", "14:33:58", "0883456629", 100); testGSM.AddCall("12.04.2014", "20:22:00", "0883454629", 300); testGSM.AddCall("12.05.2014", "10:12:45", "0889834231", 540); testGSM.AddCall("01.01.2015", "09:09:37", "0883454629", 240); testGSM.AddCall("12.05.2014", "11:00:03", "0889834231", 70); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(testGSM.ShowHistory()); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("Total call price: {0:F2}", testGSM.TotalCallPrice(0.37m)); Console.ResetColor(); testGSM.RemoveCall(3); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("The total call price after deleting the longest call: {0:F2}", testGSM.TotalCallPrice(0.37m)); Console.ResetColor(); testGSM.ClearHistory(); Console.WriteLine("Call history deleted!!!"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(testGSM.ShowHistory()); Console.ResetColor(); }
private static void CallTest() { GSM testGSM = new GSM("Nokia", "Lumia", 400, "Nikoi", new Battery("0093/478AS/9IOF1", 240, 17, BatteryType.NiCd), new Display(6.3, 16)); testGSM.AddCall("12.04.2014", "14:33:58", "0883456629", 100); testGSM.AddCall("12.04.2014", "20:22:00", "0883454629", 300); testGSM.AddCall("12.05.2014", "10:12:45", "0889834231", 540); testGSM.AddCall("01.01.2015", "09:09:37", "0883454629", 240); testGSM.AddCall("12.05.2014", "11:00:03", "0889834231", 70); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(testGSM.ShowHistory()); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("Total call price: {0:F2}", testGSM.TotalCallPrice(0.37m)); Console.ResetColor(); testGSM.RemoveCall(3); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("The total call price after deleting the longest call: {0:F2}", testGSM.TotalCallPrice(0.37m)); Console.ResetColor(); testGSM.ClearHistory(); Console.WriteLine("Call history deleted!!!"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(testGSM.ShowHistory()); Console.ResetColor(); }
public static void TestGSMCalls() { GSM phone = new GSM("G3", "LG"); phone.AddCall(new DateTime(2016, 10, 27, 10, 35, 12), "+359888888888", 137); phone.AddCall(new DateTime(2016, 10, 29, 19, 35, 12), "+359888888888", 13); phone.AddCall(new DateTime(2016, 10, 28, 17, 35, 12), "+359888123456", 2232); phone.AddCall(new DateTime(2016, 10, 29, 13, 35, 12), "+359888654321", 101); phone.AddCall(new DateTime(2016, 10, 29, 19, 35, 12), "+359888888888", 128); Console.WriteLine(phone.CallHistoryToString()); Console.WriteLine("Total price of all list: {0}", phone.CallHistoryTotalPrice(0.37)); int maxDuration = 0; Call callWithMaxDuration = phone.CallHistory[0]; foreach (Call call in phone.CallHistory) { if (call.DurationInSec >= maxDuration) { maxDuration = call.DurationInSec; callWithMaxDuration = call; } } phone.RemoveCall(callWithMaxDuration); Console.WriteLine("Total price of all list after removing longest call: {0}", phone.CallHistoryTotalPrice(0.37)); }