static void Main(string[] args) { GSM gsm1 = new GSM("Nokia", "Nokia Corp"); GSM gsm2 = new GSM("Apple", "Apple Inc."); gsm1.Price = 1300; gsm1.Battery.HoursIdle = 120; gsm1.Battery.HoursTalk = 12; gsm1.TypeOfBattery = Battery.BatteryType.NiCd; gsm1.Battery.Model = "China"; gsm1.Display.NumberOfColors = 16; gsm1.Display.Size = 4.5; gsm1.AddCallToHistory("26.2.2013", "12:00", 0887698631, 123); gsm1.AddCallToHistory("27.2.2013", "12:00", 0887698631, 123); gsm1.AddCallToHistory("28.2.2013", "12:00", 0887698631, 123); gsm1.Owner = "Pencho"; Console.WriteLine(gsm1); Console.WriteLine(gsm1.CallPrice(0.45m)); //GSM gsm2 = GSM.IPhone4S; //Console.WriteLine(gsm2); //GSMTest gsm3 = new GSMTest(5); //foreach (var item in gsm3) //{ // Console.WriteLine(item); //} }
static void Main() { GSM mobile = new GSM("3310", "Nokia"); //Add some calls mobile.AddCallToHistory(new Call(DateTime.Now.AddDays(3), DateTime.Now.TimeOfDay, "0888123123", 120)); mobile.AddCallToHistory(new Call(DateTime.Now.AddDays(5), DateTime.Now.TimeOfDay, "0888456456", 35)); //Display call history and total price mobile.DisplayCallHistory(); Console.WriteLine("Total price: {0:F2}", mobile.CalculateTotalPrice(0.37)); Console.WriteLine(); //Remove longest call and display total price again mobile.RemoveLongestCall(); Console.WriteLine("Total price: {0:F2}", mobile.CalculateTotalPrice(0.37)); Console.WriteLine(); //Clear call history and print it mobile.ClearCallHistory(); mobile.DisplayCallHistory(); }