Ejemplo n.º 1
0
 //default constuctor that is empty
 //Problem 2: Define constructors for the GSM,
 public GSM()
 {
     this.model = null;
     this.manufacturer = null;
     this.price = null;
     this.owner = null;
     this.battery = null;
     this.display = null;
 }
Ejemplo n.º 2
0
 // full constructor null, also available
 public GSM(string model, string manufacturer, double price, string owner, 
     Battery battery, Display display)
     : this()
 {
     this.model = model;
     this.manufacturer = manufacturer;
     this.price = price;
     this.owner = owner;
     this.battery = battery;
     this.display = display;
 }
Ejemplo n.º 3
0
        static void Main()
        {
            // 7. test GSM class

            Console.WriteLine("Task 7: Write a class GSMTest to test the GSM class");

            Battery battery = new Battery("LiLon 2200", 20, 5);
            Display display = new Display(5, 1000000000);
            GSM tel1 = new GSM("S5mini", "Samsung", 3.2, "i", battery, display);
            GSM tel2 = new GSM("Alpha 5", "Samsung", 3.2, "i", battery, display);
            GSM tel3 = new GSM("Xperia Z", "Sony", 700, "Dwayne Johnson", battery, display);

            GSM[] telephones = new GSM[] { tel1, tel2, tel3 };

            foreach (GSM tel in telephones)
            {
                Console.WriteLine(tel);
            }

            Console.WriteLine(GSM.iPhone4S);
        }