public static void Test() { GSM Lenovo = new GSM("S500", "IBM", 765, "Pero", new Battery("Lenovo", 500, 400, BatteryType.NiMH), new Display(10, 2000000)); Lenovo.AddCall(new Call(new DateTime(2017, 08, 22, 08, 25, 45), "359898738350", 123)); Lenovo.AddCall(new Call(new DateTime(2017, 07, 15, 12, 20, 12), "359898738215", 45)); Lenovo.AddCall(new Call(new DateTime(2017, 11, 02, 10, 15, 33), "359894624788", 300)); foreach (Call call in Lenovo.CallHistory) { Console.WriteLine(call); } Console.WriteLine("{0:F2}", Lenovo.PhoneBill()); Call longestCall = null; for (int i = 0; i < Lenovo.CallHistory.Count; i++) { for (int j = 0; j < Lenovo.CallHistory.Count; j++) { if (Lenovo.CallHistory[i].DurationInSeconds >= Lenovo.CallHistory[j].DurationInSeconds) { longestCall = Lenovo.CallHistory[i]; } } } Lenovo.RemoveCall(longestCall); Console.WriteLine("{0:F2}", Lenovo.PhoneBill()); Lenovo.ClearCallHistory(); foreach (Call call in Lenovo.CallHistory) { Console.WriteLine(call); } }
public static void test() { GSM telephone = new GSM("S4", "Samsung"); Call numberone = new Call(telephone, DateTime.Now, 300, "0898855825"); telephone.AddCall(numberone); Call numbertwo = new Call(telephone, DateTime.Now, 350, "0898855925"); telephone.AddCall(numbertwo); Call numberthree = new Call(telephone, DateTime.Now, 300, "0898854825"); telephone.AddCall(numberthree); telephone.PrintCall(); Console.WriteLine("///////////////////"); telephone.PriceCall(); Console.WriteLine("///////////////////"); telephone.DeleteCall(2); telephone.PrintCall(); Console.WriteLine("//////////////////"); telephone.PriceCall(); Console.WriteLine("//////////////////"); telephone.ClearCall(); telephone.PrintCall(); }
static void GSMTest() { //let's create a few other phones var samsung = new GSM("Galaxy S3", "Samsung", 299, "Pesho Terziev", new Battery() { BatteryChemical = BatteryType.LiIon }, new Display() { DisplaySize = 4.8 }); var lenovo = new GSM("A536", "Lenovo", 199, new Battery(), new Display()); var htc = new GSM("Hero", "HTC", "Penka Stankova", new Battery(), new Display()); //let's print the info on those and the static iPhone 4S Console.WriteLine(GSM.apple.ToString()); Console.WriteLine(samsung.ToString()); Console.WriteLine(lenovo.ToString()); Console.WriteLine(htc.ToString()); //adding a few calls to the samsung samsung.AddCall("01.02.2016", "14:02", "0892626725", 37); samsung.AddCall("13.03.2016", "16:37", "0882412412", 152); samsung.AddCall("25.05.2016", "18:12", "0898124124", 255); //calculate the price of the calls (0.37 lv per minute) Console.WriteLine($"Price of all calls: {samsung.CallsPrice(0.37).ToString("F2")}"); Console.WriteLine(); //finally, let's print the call history Console.WriteLine(samsung.CallsInfo()); }