예제 #1
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);
        }
예제 #2
0
 // part constr
 public GSM(Battery battery, Display display)
 {
     this.BatteryPr = battery;
     this.DisplayPr = display;
 }