コード例 #1
0
    public void PhoneCalls()
    {
        GSM myPhone = new GSM("Galaxy Note II", "Samsung");

        myPhone.AddCall(new DateTime(2013, 02, 1), new DateTime(), "0891111111", 1);
        myPhone.AddCall(new DateTime(2013, 02, 2), new DateTime(), "0892222222", 2);
        myPhone.AddCall(new DateTime(2013, 02, 3), new DateTime(), "0893333333", 3);

        // Display Call History
        foreach (var call in myPhone.CallHistory)
        {
            Console.WriteLine(call);
            Console.WriteLine();
        }

        // Dispay the bill
        Console.WriteLine("Bill: {0}lv.", myPhone.CalcBill(0.37m));

           // Remove the longest call from the history and calculate the total price again.
        myPhone.CallHistory.Remove(myPhone.CallHistory[2]);
        Console.WriteLine("Bill without longest call: {0}lv.", myPhone.CalcBill(0.37m));

        //Clear CallHistory
        Console.WriteLine("Cleaned History");
        myPhone.ClearAllHistory();
    }