public static void CallHistoryTest() { GSM testGSM = GSM.IPhone4s; testGSM.AddCall("0999-999-999", 2.3); testGSM.AddCall("0888-999-999", 12.4); testGSM.AddCall("0777-999-999", 4.34); testGSM.AddCall("0666-999-999", 8.2); testGSM.AddCall("0555-999-999", 11.2); Console.WriteLine("-------Showing added calls--------"); testGSM.ShowCallHistory(); Console.WriteLine("------Calculating total price for calls------"); double totalCallPrice = testGSM.CalculateCallsTotalPrice(); Console.WriteLine("{0:C}", totalCallPrice); Console.WriteLine("----Removing longest call and recalculating-----"); testGSM.RemoveLongestCallEntry(); testGSM.ShowCallHistory(); totalCallPrice = testGSM.CalculateCallsTotalPrice(); Console.WriteLine("{0:C}", totalCallPrice); Console.WriteLine("----Clearing call history-----"); testGSM.ClearCallHistory(); testGSM.ShowCallHistory(); }
static void Main() { Display someDisplay = new Display("4.5inch", "165Million"); Battery someBattery = new Battery("Varta", 10.00, 10.00); GSM myPhone = new GSM("G3", "JIAYU", "Pencho", 390.00m, someBattery, someDisplay); myPhone.AddCallToHist(DateTime.Now, "088617555", 180); myPhone.AddCallToHist(DateTime.Now, "099953312", 2000); myPhone.AddCallToHist(DateTime.Now, "125989364", 369); myPhone.AddCallToHist(DateTime.Now, "058933153", 600); myPhone.DisplayCallHistory(); Console.WriteLine("Price for all calls"); //calculating totalPrice for all calls decimal pricePerMinute = 0.37m; decimal totalPrice = 0m; totalPrice=myPhone.TotalPriceCall(pricePerMinute); Console.WriteLine(totalPrice); //Remove LongestCall and calculating price again myPhone.RemoveLongestCall(); Console.WriteLine("Price for all calls after removing the longest call"); totalPrice = myPhone.TotalPriceCall(pricePerMinute); Console.WriteLine(totalPrice); myPhone.DisplayCallHistory(); myPhone.ClearCallHistory(); Console.WriteLine("This is cleared call history:"); myPhone.DisplayCallHistory(); }
private static void GSMCallHistoryTest() { GSM testGsm = new GSM("Nokia", "TelerikCorp"); testGsm.AddCall("+359873432142", 53); testGsm.AddCall("+359811432142", 123); testGsm.AddCall("+359872412142", 41); testGsm.AddCall("+359833332142", 72); testGsm.AddCall("+359614432142", 231); testGsm.ShowCallHistory(); Console.WriteLine("Total call price: " + testGsm.TotalCallPrice()); testGsm.DeleteCall(5); Console.WriteLine("Removed Longest call!"); Console.WriteLine("Total call price: " + testGsm.TotalCallPrice()); testGsm.ClearCallHistory(); Console.WriteLine("Cleared call history!"); testGsm.ShowCallHistory(); }
public static void TestCallHistory() { Call call0 = new Call("31.3.2015 9:08:33", "00359 888888", 60); Call call1 = new Call("01.4.2015 22:19:04", "+44 123123", 578); Call call2 = new Call("02.05.2016 02:16:00", "02 967 2323", 134); gsm.AddCall(call0); gsm.AddCall(call1); gsm.AddCall(call2); gsm.ShowCallHistory(); decimal pricePerMinute = 0.37m; Console.WriteLine("Total price: {0:C}", gsm.CalculateTotalPriceOfCalls(pricePerMinute)); gsm.DeleteCall(1); Console.WriteLine("Total price: {0:C}", gsm.CalculateTotalPriceOfCalls(pricePerMinute)); gsm.ClearCallHistory(); gsm.ShowCallHistory(); }