Esempio n. 1
0
        public static void HistoryTest()
        {
            GSM one = new GSM("mod", "manu");

            Console.WriteLine(one.CallHistory.Count);

            Call someCall = new Call("135", 100);
            Call two      = new Call("6541651", 102);

            one.AddCall(someCall);
            Console.WriteLine(one.CallHistory.Count);
            one.AddCall(two);
            Console.WriteLine(one.CallHistory.Count);

            Console.WriteLine(one.CalcPriceOfCalls());


            Console.WriteLine(one.ToString());

            one.RemoveLongestCall();

            Console.WriteLine(one.ToString());
        }
Esempio n. 2
0
        static void Main()
        {
            var gsm = new GSM("Samsung", "S7 Edge+", 1200.0m, "Stamat", new Battery {
                Model = "G1567", HoursIdle = 78, HoursTalk = 20,
            }, new Display {
                Size = 5.4, NumberOfColors = 64000000
            }, BatteryType.NiCd);

            gsm.CallHistory.Add(new Call()
            {
                Duration = 1000, DialedPhone = "+359********9"
            });

            for (int i = 0; i < 10; i++)
            {
                gsm.AddCall(new Call()
                {
                    DialedPhone = "+359********" + i,
                    Duration    = (uint)(i + 1) * 120
                });
            }

            var maxCall = new Call();

            foreach (Call call in gsm.CallHistory)
            {
                Console.WriteLine(call);
                if (maxCall.Duration < call.Duration)
                {
                    maxCall = call;
                }
            }

            Console.WriteLine("Total calls: {0}", gsm.CalculateTotalCost(0.37m));
            gsm.DeleteCall(maxCall);
            Console.WriteLine("Total calls without Longest Call: {0}", gsm.CalculateTotalCost(0.37m));

            Console.WriteLine(gsm.ToString());

            Console.WriteLine(GSM.Iphone4S);
        }