public static void Dothings() { Console.WriteLine(GSM.CallSum()); GSM.DeleteLongestCall(); Console.WriteLine(GSM.CallSum()); while (GSM.History.Count() > 0) { GSM.DeleteCalls(0); } }
//Create an array of few instances of the GSM class. //Display the information about the GSMs in the array. //Display the information about the static property IPhone4S. public static void Print() { GSM NokiaLumia = new GSM("Lumia", "Nokia", 330, "John", 24, 5, "Lumiabattery", 5.5, 16000000); GSM Siemens = new GSM("S65", "Siemens", 600, "Todor", 100, 8, "S65battery", 3.5, 160); GSM Sony = new GSM("K800", "Sony", 800, "Pesho", 180, 12, "K800battery", 4.0, 32000000); GSM[] magazin = new GSM[] { NokiaLumia, Siemens, Sony }; for (int i = 0; i < magazin.Count(); i++) { Console.WriteLine(magazin[i].ToString()); Console.WriteLine(); } Console.WriteLine(GSM.IPhone4s); }
public static void DeleteLongestCall() { DateTime current = new DateTime(); DateTime max = new DateTime(); int position = 0; int currentposition = 0; foreach (var item in GSM.History) { current = ToTime(item.Duration); if (current.TimeOfDay > max.TimeOfDay) { max = current; position = currentposition; } currentposition++; } GSM.DeleteCalls(position); }
public static void Enter() { GSM.AddCalls("11.12.2017", "10:53:28", 0898282842, "00:01:29"); GSM.AddCalls("15.12.2017", "12:43:28", 0898243245, "00:02:42"); GSM.AddCalls("16.12.2017", "15:25:28", 0894983839, "00:00:42"); }