public Call(GSM phone, DateTime date, int duration, string phonenumb) { Call.date = date; Call.Phone = phone; Call.duration = duration; Call.phonenumber = phonenumb; }
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(); }
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); } }
static void Main(string[] args) { GSMTest printting = new GSMTest(); GSM telefon1 = new GSM("Nokia", "tanq"); printting.DisplayInfoIphone4S(); Console.WriteLine("/////////////////////////"); printting.Print(); GSMCallHistoryTest.test(); Console.WriteLine(telefon1.WriteEverything()); }
public static void GSMTest() { Console.WriteLine("---- GSM TEST ---- "); GSM[] testGSMs = new GSM[3]; testGSMs[0] = new GSM("3310", "NOKIA", 5, "Pesho", new Battery(BatteryType.LiIon, 100, 10), new Display(3, 100)); testGSMs[1] = new GSM("c50", "Siemens", 10, "Gosho", new Battery(BatteryType.NiCd, 50, 5), new Display(4, 500)); testGSMs[2] = new GSM("5s", "Apple", 15, "Petkan", new Battery(BatteryType.NiMH, 10, 1), new Display(5, 1000)); Console.WriteLine(testGSMs[0]); Console.WriteLine(testGSMs[1]); Console.WriteLine(testGSMs[2]); Console.WriteLine(GSM.Iphone4s); }
static void Main() { //Task 7 GSMtest.GSMTest(); //Task 12 //Create an instance of the GSM class. var battery = new Battery(BatteryType.LiIon, 100, 10); var display = new Display(2.5m, 5000); var gsm = new GSM("3310", "NOKIA", 25.5m, "Pencho", battery, display); //Add few calls. var call1 = new Calls("06/12/2016", "13:41", "0888 12 34 56", 10); var call2 = new Calls("06/12/2016", "15:41", "0888 12 34 56", 20); var call3 = new Calls("06/12/2016", "17:41", "0888 12 34 56", 30); gsm.AddCalls(call1); gsm.AddCalls(call2); gsm.AddCalls(call3); //Display the information about the calls. Console.WriteLine(call1); Console.WriteLine(call2); Console.WriteLine(call3); //Assuming that the price per minute is 0.37 calculate and print the total price of the calls in the history. Console.WriteLine($"Total calls price = {gsm.CalculateCallPrice(0.37m)}"); //Remove the longest call from the history and calculate the total price again. Calls longest = gsm.CallsHistory[0]; foreach (var call in gsm.CallsHistory) { if (call.CallDuration > longest.CallDuration) { longest = call; } } gsm.DeleteCalls(longest); Console.WriteLine($"Total calls price after the longest call is removed = {gsm.CalculateCallPrice(0.37m)}"); //Finally clear the call history and print it. gsm.ClearCallHistory(); Console.WriteLine($"Calls history cleared"); }
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()); }