コード例 #1
0
        public void TestCallHistory()
        {
            var a = new Call(new DateTime(2018, 07, 21, 10, 54, 6), new DateTime(2018, 07, 21, 10, 54, 6), "0888 265 897", 55);

            lastGSM.AddCall(a);
            var b = new Call(new DateTime(2018, 07, 21, 12, 35, 9), new DateTime(2018, 07, 21, 12, 35, 9), "0887 355 887", 60);

            lastGSM.AddCall(b);
            var c = new Call(new DateTime(2018, 07, 21, 13, 38, 10), new DateTime(2018, 07, 21, 13, 38, 10), "0879 548 486", 30);

            lastGSM.AddCall(c);

            Console.WriteLine(lastGSM.CallHistoryInfo());
            Console.WriteLine("Total Price: {0:C2}", lastGSM.CalculatePrice(pricePerMin));

            var longestCall = lastGSM.CallHistory.OrderByDescending(x => x.Duration).First();

            lastGSM.RemoveCall(longestCall);

            Console.WriteLine("Price after deleting the longest call: {0:C2}", lastGSM.CalculatePrice(pricePerMin));

            lastGSM.ClearHistory();

            Console.WriteLine(lastGSM.CallHistoryInfo());
        }
コード例 #2
0
 static void Main()
 {
     GSM nokia = new GSM("E-65", "Nokia");
     nokia.AddCall("0889186005", 237);
     nokia.AddCall("0889182205", 114);
     nokia.AddCall("0889346005", 87);
     nokia.AddCall("0889346108", 111);
     nokia.DisplayCallInformation();
     Console.WriteLine("Current bill for this number {0} Leva.\n", nokia.GetCallsPrice(0.37m));
     nokia.RemoveCall();
     nokia.DisplayCallInformation();
     nokia.ClearCallHistory();
     nokia.DisplayCallInformation();
 }
コード例 #3
0
        static void Main()
        {
            GSM nokia = new GSM("E-65", "Nokia");

            nokia.AddCall("0889186005", 237);
            nokia.AddCall("0889182205", 114);
            nokia.AddCall("0889346005", 87);
            nokia.AddCall("0889346108", 111);
            nokia.DisplayCallInformation();
            Console.WriteLine("Current bill for this number {0} Leva.\n", nokia.GetCallsPrice(0.37m));
            nokia.RemoveCall();
            nokia.DisplayCallInformation();
            nokia.ClearCallHistory();
            nokia.DisplayCallInformation();
        }