Пример #1
0
        public void Test()
        {
            //Create an array of few instances of the GSM class.
            const int numberOfGSMs = 2;
            Gsm[] gsmArr = new Gsm[numberOfGSMs];

            gsmArr[0] = new Gsm("101", "Nokia", 4.30f, "Gencho",
                new Batterys("nokia", 540.5, 13.8, BatteryType.NiCd), new Displays(2.0f, 32000));

            gsmArr[1] = new Gsm("GalaxyS4", "Samsung", 254.30f,
                new Batterys("Sony", BatteryType.NiMH), new Displays(4.00f, 65000));

            // Display the information about the GSMs in the array.
            Console.WriteLine("Gsm Information:\n");

            for (int i = 0; i < gsmArr.Length; i++)
            {
                Console.WriteLine(gsmArr[i]);
                Console.WriteLine();
            }

            // Display the information about the static property IPhone4S.
            Console.WriteLine("\nIphone4s information:\n");
            Console.WriteLine(Gsm.Iphone4S);
        }
Пример #2
0
        public void Test()
        {
            //Create an array of few instances of the GSM class.
            const int numberOfGSMs = 2;

            Gsm[] gsmArr = new Gsm[numberOfGSMs];

            gsmArr[0] = new Gsm("101", "Nokia", 4.30f, "Gencho",
                                new Batterys("nokia", 540.5, 13.8, BatteryType.NiCd), new Displays(2.0f, 32000));

            gsmArr[1] = new Gsm("GalaxyS4", "Samsung", 254.30f,
                                new Batterys("Sony", BatteryType.NiMH), new Displays(4.00f, 65000));

            // Display the information about the GSMs in the array.
            Console.WriteLine("Gsm Information:\n");

            for (int i = 0; i < gsmArr.Length; i++)
            {
                Console.WriteLine(gsmArr[i]);
                Console.WriteLine();
            }

            // Display the information about the static property IPhone4S.
            Console.WriteLine("\nIphone4s information:\n");
            Console.WriteLine(Gsm.Iphone4S);
        }
Пример #3
0
        public void Test()
        {
            // Create an instance of the GSM class.
            Gsm gsm = Gsm.Iphone4S;

            // Add few calls.
            gsm.AddCall(new Call(DateTime.Now, "0888 333 555", 343u));

            gsm.AddCall(new Call(DateTime.Now.AddMinutes(13.12d), "0888 333 888", 5436u));

            gsm.AddCall(new Call(DateTime.Now.AddHours(3.5d), "0898 454 888", 4893u));

            // Display the information about the calls.
            Console.WriteLine("\nCalls information:");

            for (int i = 0; i < gsm.CallHistory.Count; i++)
            {
                Console.WriteLine(gsm.CallHistory[i]);
            }

            // print the total price of the calls in the history.
            Console.WriteLine("\nTotal call price in the history: {0:C}.",
                              gsm.CalculateCallsPrice(0.37m));

            // Remove the longest call from the history and calculate the total price again.
            Call longestCall = GetLongestCall(gsm.CallHistory);

            gsm.RemoveCall(longestCall);

            Console.WriteLine("\nTotal call price in the history whitout longest call: {0:C}.",
                              gsm.CalculateCallsPrice(0.37m));

            // Finally clear the call history and print it.
            gsm.ClearCallsHistory();

            Console.WriteLine("\nNumber of calls in call history: {0}\n", gsm.CallHistory.Count);
        }
Пример #4
0
 static Gsm()
 {
     iphone4S = new Gsm("Iphone4S", "Apple", 754.30f,
         new Batterys("Iphone", BatteryType.Li_Ion), new Displays(3.2f, 256));
 }
Пример #5
0
 static Gsm()
 {
     iphone4S = new Gsm("Iphone4S", "Apple", 754.30f,
                        new Batterys("Iphone", BatteryType.Li_Ion), new Displays(3.2f, 256));
 }