public static void Main2() { //create a GSM instance Battery battery = new Battery("helolModel", 1500, 1000, BatteryType.LiIon); Display display = new Display("100x85", 256); GSM tel = new GSM("s400", "Samsung", 500, "Rosen", battery, display); //adding calls tel.AddCall(DateTime.Now, "0884 667 697", 346); tel.AddCall(DateTime.Now.AddHours(6), "0884 789 567", 200); tel.AddCall(DateTime.Now.AddDays(1), "0884 667 697", 100); tel.AddCall(DateTime.Now.AddHours(10), "0884 789 567", 500); tel.AddCall(DateTime.Now.AddMonths(1).AddHours(10), "0884 667 697", 700); //printing Console.ForegroundColor = ConsoleColor.Gray; tel.Print(); Console.WriteLine("Total price of the calls : {0}eu : 0.37eu for minute\n", tel.CalculateCalls(0.37)); tel.DeletingCall("0884 667 697", 700); tel.Print(); Console.WriteLine("Total price of the calls : {0}eu : 0.37eu for minute\n", tel.CalculateCalls(0.37)); tel.ClearHistory(); Console.WriteLine("Cleared history: "); tel.Print(); }
public static void Run() { var nokia = new GSM("3310", "Nokia", 5.23M, "Mia", new Battery("Lalallalaallal", 18, 5, BatteryType.NiCd), new Display(18.5, 18)); var gsms = new[] { nokia, new GSM("Aria", "HTC", 500M, "Mimi", new Battery("HTC", 200, 8, BatteryType.LiIon), new Display(3, 65536)), GSM.IPhone4S }; foreach (var gsm in gsms) { Console.WriteLine(gsm); } }
public static void Run() { GSM test = GSM.IPhone4S; var testCall1 = new Call(DateTime.Now, "+1564897133548", new TimeSpan(0, 22, 05, 46)); var testCall2 = new Call(DateTime.Now, "+359888888888", new TimeSpan(0, 5, 26, 1)); var testCall3 = new Call(DateTime.Now, "+0492326646548", new TimeSpan(0, 0, 5, 46)); var testCall4 = new Call(DateTime.Now, "+228845664564687", new TimeSpan(0, 0, 26, 03)); var testCall5 = new Call(DateTime.Now, "+00178789777777", new TimeSpan(0, 1, 18, 48)); test.AddCalls(testCall1, testCall2, testCall3, testCall4, testCall5); Console.WriteLine(string.Join(Environment.NewLine, test.CallHistory)); Console.WriteLine("Total price: {0:c}", test.CalculateTotalCallPrice(0.37M)); Console.WriteLine(); test.RemoveCall(GetLongest(test.CallHistory)); Console.WriteLine(string.Join(Environment.NewLine, test.CallHistory)); Console.WriteLine("Total price: {0:C}", test.CalculateTotalCallPrice(0.37M)); Console.WriteLine(); test.ClearCallHistory(); }