Exemple #1
0
 //, Display display
 // constructor
 public GSM(string model, string manufacturer, decimal price, string owner, Battery battery)
 {
     this.Model = model;
     this.Manufacturer = manufacturer;
     this.Price = price;
     this.Owner = owner;
     //this.DisplayPr = display; // ? can do this without this settings ? how ? what is differences ?
     this.BatteryPr = battery;
 }
Exemple #2
0
        static void Main(string[] args)
        {
            GSM firstGSM = new GSM();
            firstGSM.Model = "Nokia";
            firstGSM.Manufacturer = "Germany";
            firstGSM.Price = 105.95M;
            firstGSM.Owner = "Peter";
            GSM secondGSM = new GSM();

            Console.WriteLine("\"{0}\" this is first model made in {2}, price - {3:C}, Owner - {4} \nand this \"{1}\" is second model.", firstGSM.Model, secondGSM.Model, firstGSM.Manufacturer, firstGSM.Price,firstGSM.Owner);

            Battery test = new Battery("NiCd", 14, 12);
            Console.WriteLine(test.ModelBattery + " - " + test.HoursIDLE + " - " + test.HoursTalk);
            GSM prob = new GSM();
            prob.DisplayPr.Size = 12;
            prob.DisplayPr.NumberColor = 32;
            prob.BatteryPr.HoursTalk = 10;

            Console.WriteLine("size - {0}, number of color(s) - {1}", prob.DisplayPr.Size, prob.DisplayPr.NumberColor);
            Console.WriteLine("Talk time {0} hour(s)", prob.BatteryPr.HoursTalk);
            Console.WriteLine();

            // Problem 2
            Console.WriteLine("===== - Problem 2 - =====");
            double price = 199.90D;
            GSM problem2 = new GSM("Alcatel", 250);
            Console.WriteLine("New model of {0} cost {1} BGN", problem2.Model, problem2.Price);

                // second test2
            Battery batteryT2 = new Battery("Li-Ion");
            Display displayT2 = new Display(12.5);
            string nameT2 = "Motorola";
            GSM gsmT2 = new GSM(batteryT2, displayT2);
            Console.WriteLine("GSM {0}. Have battery - '{1}' and display - '{2}'.", nameT2, batteryT2.ModelBattery, displayT2.Size);
        }
Exemple #3
0
 // part constr
 public GSM(Battery battery, Display display)
 {
     this.BatteryPr = battery;
     this.DisplayPr = display;
 }