Esempio n. 1
0
        static void Main()
        {
            var testGSM = new GSM();

            Console.WriteLine(GSM.iPhone4S.ToString()); // Displaying Iphone info

            var gsms = GSMTest.GenerateGSMs();          //Task 7 - GSM Test Class info

            GSMTest.PrintGSMsInfo(gsms);

            //problem 12

            var callsRegister = GSMCallHistoryTest.CreateCalltestHistory();  // Print Call History

            GSM.PrintCallHistory(callsRegister);
            GSMCallHistoryTest.CalculateAndPrintTestcallsPrice();   // Printing the total price of the Call History
            Console.WriteLine(new string('-', 50));
            GSMCallHistoryTest.RemoveLongestCall();                 // Printing the total price witout the longest call
            Console.WriteLine(new string('-', 50));

            Console.WriteLine("Clearing Data........");             // Clearing call history and printing the empty List<Call>;
            callsRegister.Clear();
            GSM.PrintCallHistory(callsRegister);
            Console.WriteLine("Call History data cleared !");
        }
Esempio n. 2
0
        public static void RemoveLongestCall()
        {
            List <Call> longestCall = generateCalls.OrderBy(x => x.Duration).ToList(); //getting the longest call from the list of calls

            longestCall.RemoveAt(longestCall.Count - 1);
            decimal price = GSM.CalculateTotalCallPrice(longestCall, 0.37M); //using method of the GSM class

            Console.WriteLine("Total price without longest call: {0:F2}", price);
        }
Esempio n. 3
0
        public static GSM[] GenerateGSMs()
        {
            GSM[] gsms = new GSM[5];
            var   b    = new Battery("Bateriq Raketa", 300, 25, BatteryType.LiPoly);
            var   disp = new Display(400, 20000);

            for (int i = 0; i < 5; i++)
            {
                gsms[i] = new GSM(model[i], manufacturers[i], priceRange[i], owner[i], b, disp);
            }

            return(gsms);
        }
Esempio n. 4
0
        public static void CalculateAndPrintTestcallsPrice()
        {
            decimal price = GSM.CalculateTotalCallPrice(generateCalls, 0.37M); //using method of the GSM class

            Console.WriteLine("Total price of test calls: {0:F2}", price);
        }