//Methods public static void DisplayInfo(GSM phone) { Console.WriteLine("Phone Manufacturer: {0}", phone.manufacturer); Console.WriteLine("Phone Model: {0}", phone.model); if (phone.price != null) { Console.WriteLine("Phone Price: {0}BGN", phone.price); } if (phone.owner != null) { Console.WriteLine("Phone Owner: {0}", phone.owner); } if (phone.Battery != null) { Console.Write("Phone Battery: "); Console.Write("Hours Idle = {0} | Hours Talk = {1} | Type = {2}", phone.Battery.HoursIdle, phone.Battery.HoursTalk, phone.Battery.Type); Console.WriteLine(); } if (phone.Display != null) { Console.Write("Phone Display: "); Console.Write("Size = {0} | Colors = {1}", phone.Display.DisplaySize, phone.Display.DisplayColors); Console.WriteLine(); } Console.WriteLine("----------------------------------------------------"); }
static GSM() { var baterry = new Battery(20, 10, BatteryType.LiIon); var display = new Display(4, 1600000); iPhone4S = new GSM("Apple", "iPhone 4S", 1400, "Pesho", baterry, display); }
public static void TestCallHistory() { GSM Nexus = new GSM("LG", "Nexus", 600, "Lucho", new Battery(10, 15, BatteryType.LiIon)); Nexus.AddCall(new Call("18.12.2016", "15:30", 1111345, 30)); Nexus.AddCall(new Call("19.12.2016", "17:30", 3333345, 60)); Nexus.AddCall(new Call("20.12.2016", "20:00", 7777345, 30)); Nexus.DisplayCallHistory(); Call.CalculatePrice(0.37); Nexus.ClearCallHistory(); Nexus.DisplayCallHistory(); }