Exemple #1
0
        static void Main()
        {
            Display someDisplay = new Display("4.5inch", "165Million");
            Battery someBattery = new Battery("Varta", 10.00, 10.00);

            GSM myPhone = new GSM("G3", "JIAYU", "Pencho", 390.00m, someBattery, someDisplay);

            myPhone.AddCallToHist(DateTime.Now, "088617555", 180);
            myPhone.AddCallToHist(DateTime.Now, "099953312", 2000);
            myPhone.AddCallToHist(DateTime.Now, "125989364", 369);
            myPhone.AddCallToHist(DateTime.Now, "058933153", 600);

            myPhone.DisplayCallHistory();
            Console.WriteLine("Price for all calls");
            //calculating totalPrice for all calls
            decimal pricePerMinute = 0.37m;
            decimal totalPrice = 0m;
            totalPrice=myPhone.TotalPriceCall(pricePerMinute);
            Console.WriteLine(totalPrice);

            //Remove LongestCall and calculating price again
            myPhone.RemoveLongestCall();
            Console.WriteLine("Price for all calls after removing the longest call");
            totalPrice = myPhone.TotalPriceCall(pricePerMinute);
            Console.WriteLine(totalPrice);
            myPhone.DisplayCallHistory();
            myPhone.ClearCallHistory();
            Console.WriteLine("This is cleared call history:");
            myPhone.DisplayCallHistory();
        }
Exemple #2
0
        public static void HistoryTest()
        {
            GSM one = new GSM("mod", "manu");

            Console.WriteLine(one.CallHistory.Count);

            Call someCall = new Call("135", 100);
            Call two      = new Call("6541651", 102);

            one.AddCall(someCall);
            Console.WriteLine(one.CallHistory.Count);
            one.AddCall(two);
            Console.WriteLine(one.CallHistory.Count);

            Console.WriteLine(one.CalcPriceOfCalls());


            Console.WriteLine(one.ToString());

            one.RemoveLongestCall();

            Console.WriteLine(one.ToString());
        }