//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());
        }
Example #2
0
 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>();
        }
 public Battery(Battery battery)
 {
     if (battery != null)
     {
         this.Model = battery.Model;
         this.IdleHours = battery.IdleHours;
         this.TalkHours = battery.TalkHours;
         this.BatteryType = battery.BatteryType;
     }
     else
     {
         this.Model = null;
         this.IdleHours = null;
         this.TalkHours = null;
         this.BatteryType = null;
     }
 }