Exemplo n.º 1
0
        static void Main()
        {
            GSM[] testArr = new GSM[3];
            GSM nokia = new GSM("Nokia2010", "Nokia", "Gosho", 320);
            GSM samsung = new GSM("Galaxy S2", "Samsung", "Gabriel", 620);
            GSM siemens = new GSM("A2", "Siemens", "Yana", 9);
            testArr[0] = nokia;
            testArr[1] = samsung;
            testArr[2] = siemens;
            for (int i = 0; i < testArr.Length; i++)
            {
                Console.WriteLine(testArr[i]);
            }
            Console.WriteLine(GSM.IPhone4S);

            Call call1 = new Call("21.02.2013", "12:30", "0888 888 888", 58);
            Call call2 = new Call("21.02.2013", "13:30", "0888 888 865", 23);
            Call call3 = new Call("21.02.2013", "12:50", "0888 888 848", 12);
            Call call4 = new Call("21.02.2013", "15:12", "0888 328 888", 135);

            nokia.AddCalls(call1);
            nokia.AddCalls(call2);
            nokia.AddCalls(call3);
            nokia.AddCalls(call4);
            for (int i = 0; i < nokia.CallHistory.Count; i++)
            {
                Console.WriteLine("Call {0}: Date:{1}, Time:{2}, Number:{3}, Duration:{4}",
                    i + 1, nokia.CallHistory[i].Date, nokia.CallHistory[i].Time,
                    nokia.CallHistory[i].DialedPhoneNum, nokia.CallHistory[i].CallDuration);
            }
            Console.WriteLine("Total fee is: {0}", nokia.CalculatePriceForCalls(0.37f));
            nokia.DeleteCalls(3);
            Console.WriteLine("Total fee without the fourth call is: {0}", nokia.CalculatePriceForCalls(0.37f));
            nokia.ClearCallHistory();
            Console.WriteLine("Total fee with cleared call history is: {0}", nokia.CalculatePriceForCalls(0.37f));
        }
Exemplo n.º 2
0
  // methods task 10
 public void AddCalls(Call call)
 {
     callHistory.Add(call);
 }