//Task 07 public static void TestGSM() { Console.WriteLine("Testing GSMs:\n"); Battery newBattery = new Battery("Tesla Battery", 300, 10, BatteryType.LiIon); Display newDisplay = new Display(12000000, new int[] { 10, 10 }); GSM motorollaGSM = new GSM("T100", "Motorola", null, null, newBattery, newDisplay); GSM nokiaGSM = new GSM("c101", "Nokia", 20, "Me", new Battery("NokiaBattery"), new Display(2000, new int[] { 32, 64 })); GSM alcatelGSM = new GSM("alcatel", "China"); GSM[] manyGSMs = new GSM[] { motorollaGSM, nokiaGSM, alcatelGSM }; foreach (GSM gsm in manyGSMs) { Console.WriteLine(gsm.ToString()); Console.WriteLine(); } Console.WriteLine("Iphone 4S Info:"); Console.WriteLine(motorollaGSM.IPhone4SInfo.ToString()); }
public GSM(string model, string manufacturer, double? price, string owner, Battery battery, Display display) { this.Model = model; this.Manufacturer = manufacturer; this.Price = price; this.Owner = owner; this.Battery = battery; this.Display = display; }
//Task 02 public GSM(string model, string manufacturer, double? price, string owner, Battery battery, Display display) { this.Model = model; this.Manufacturer = manufacturer; this.Price = price; this.Owner = owner; this.Battery = new Battery(battery); this.Display = new Display(display); //Initiate CallHistory also this.callHistory = new List<Call>(); }
//Copy Constructor public Display(Display display) { if (display != null) { this.Colors = display.Colors; this.Size = display.size; } else { this.Colors = null; this.Size = null; } }