コード例 #1
0
        public void GSMCallHistoryTesting()
        {
            // Create an instance of the GSM class.
            GSM testGsm = new GSM("Nokia", "TelerikCorp");

            // Add few calls.
            testGsm.AddCall("9873432142", 53);
            testGsm.AddCall("9811433144", 123);
            testGsm.AddCall("9872411149", 41);

            // Display the information about the calls.
            testGsm.ShowCallHistory();

            // Assuming that the price per minute is 0.37 calculate and print the total price of the calls in the history.
            Console.WriteLine("Total call price: " + testGsm.TotalCallPrice());

            //  Remove the longest call from the history and calculate the total price again.
            testGsm.DeleteCall(2);
            Console.WriteLine("Removed Longest call!");
            Console.WriteLine("Total call price: " + testGsm.TotalCallPrice());

            //// Clear the call history and print it.
            //testGsm.ClearCallHistory();
            //Console.WriteLine("Cleared call history!");
            //testGsm.ShowCallHistory();
        }
コード例 #2
0
        private static void GSMCallHistoryTest()
        {
            GSM testGsm = new GSM("Nokia", "TelerikCorp");

            testGsm.AddCall("+359873432142", 53);
            testGsm.AddCall("+359811432142", 123);
            testGsm.AddCall("+359872412142", 41);
            testGsm.AddCall("+359833332142", 72);
            testGsm.AddCall("+359614432142", 231);

            testGsm.ShowCallHistory();

            Console.WriteLine("Total call price: " + testGsm.TotalCallPrice());

            testGsm.DeleteCall(5);
            Console.WriteLine("Removed Longest call!");

            Console.WriteLine("Total call price: " + testGsm.TotalCallPrice());

            testGsm.ClearCallHistory();
            Console.WriteLine("Cleared call history!");
            testGsm.ShowCallHistory();
        }