public static void Run()
        {
            GSM test = GSM.IPhone4S;

            var testCall1 = new Call(DateTime.Now, "+1564897133548", new TimeSpan(0, 22, 05, 46));
            var testCall2 = new Call(DateTime.Now, "+359888888888", new TimeSpan(0, 5, 26, 1));
            var testCall3 = new Call(DateTime.Now, "+0492326646548", new TimeSpan(0, 0, 5, 46));
            var testCall4 = new Call(DateTime.Now, "+228845664564687", new TimeSpan(0, 0, 26, 03));
            var testCall5 = new Call(DateTime.Now, "+00178789777777", new TimeSpan(0, 1, 18, 48));

            test.AddCalls(testCall1, testCall2, testCall3, testCall4, testCall5);

            Console.WriteLine(string.Join(Environment.NewLine, test.CallHistory));
            Console.WriteLine("Total price: {0:c}", test.CalculateTotalCallPrice(0.37M));
            Console.WriteLine();

            test.RemoveCall(GetLongest(test.CallHistory));

            Console.WriteLine(string.Join(Environment.NewLine, test.CallHistory));
            Console.WriteLine("Total price: {0:C}", test.CalculateTotalCallPrice(0.37M));
            Console.WriteLine();

            test.ClearCallHistory();
        }
Exemple #2
0
 //methods
 //Add methods in the GSM class for
 //adding and deleting calls from
 //    the calls history.
 //Add a method to clear the call history.
 public void AddCall(DateTime time, string phoneNumber, int durr)
 {
     Call calling = new Call(time, durr, phoneNumber);
     historyBook.Add(calling);
 }
Exemple #3
0
 public bool RemoveCall(Call call)
 {
     return this.CallHistory.Remove(call);
 }