public static void TestHistory()
        {
            GSM testPhone = new GSM("Lumia", "Nokia", 259.99, "Me", "BatPro", 8.4, 2.3, 1, "5'", "16M");

            Console.WriteLine(testPhone);
            testPhone.addCallToHistory(new Call(DateTime.Now, "0888114477", 25));
            testPhone.addCallToHistory(new Call(DateTime.Now, "0888225588", 18));
            testPhone.addCallToHistory(new Call(DateTime.Now, "0888336699", 67));
            Console.WriteLine("Calls:\n");
            foreach (Call call in testPhone.CallHistory)
            {
                Console.WriteLine(call);
            }
            Console.WriteLine("Total price of calls: {0:0.00}", testPhone.CallPrice());
            int max      = -1;
            int remIndex = 0;

            foreach (Call call in testPhone.CallHistory)
            {
                if (call._durationSec > max)
                {
                    max      = call._durationSec;
                    remIndex = testPhone.CallHistory.IndexOf(call);
                }
            }
            testPhone.delCallFromHistory(2);
            Console.WriteLine("Total price of calls after removal of longest call: {0:0.00}", testPhone.CallPrice());
            testPhone.clearCallHistory();
            Console.WriteLine("Total price after clearing calls: {0:0.00}", testPhone.CallPrice());
        }
        public static void CallHistory()
        {
            GSM callTest = new GSM();
            callTest.Owner = "Pesho";

            callTest.AddCall("June 5th", "05:00am","088888888", 60);
            callTest.AddCall("June 6th", "06:00am", "088888888", 180);
            callTest.AddCall("June 7th", "07:00am", "088888888", 60);
            callTest.AddCall("June 8th", "08:00am", "088888888", 60);

            callTest.PrintHistory();
            Console.WriteLine("Total price: " + callTest.TotalCallPrice(0.37));
            callTest.RemoveLongestCall();

            //callTest.AddCall(new Call("11th June", "11pm", "0888888888", 55));
            //callTest.AddCall(new Call("12 June", "12pm" , "0888888888", 120));
        }
示例#3
0
        public static void CallHistory()
        {
            GSM callTest = new GSM();

            callTest.Owner = "Pesho";

            callTest.AddCall("June 5th", "05:00am", "088888888", 60);
            callTest.AddCall("June 6th", "06:00am", "088888888", 180);
            callTest.AddCall("June 7th", "07:00am", "088888888", 60);
            callTest.AddCall("June 8th", "08:00am", "088888888", 60);

            callTest.PrintHistory();
            Console.WriteLine("Total price: " + callTest.TotalCallPrice(0.37));
            callTest.RemoveLongestCall();


            //callTest.AddCall(new Call("11th June", "11pm", "0888888888", 55));
            //callTest.AddCall(new Call("12 June", "12pm" , "0888888888", 120));
        }