Пример #1
0
        static void Main()
        {
            GSM mobile = new GSM("Samsung", "Galaxy S5360", 330, "Evgeni Velikov");

            mobile.AddCall(new Call(300));
            mobile.AddCall(new Call(4000));
            mobile.AddCall(new Call(120));

            Console.WriteLine("Total Price: {0:C}", mobile.CalculateTotalPrice());

            mobile.RemoveCall(new Call(4000));

            Console.WriteLine("Total Price After Remove: {0:C}", mobile.CalculateTotalPrice());

            mobile.RemoveAllCall();

            Console.WriteLine("Remove Total Price: {0:C}", mobile.CalculateTotalPrice());

            Console.WriteLine();

            mobile.battery.HoursIdle = 340;
            mobile.battery.HoursTalk = 12;
            mobile.battery.Model     = BatteryType.Li_Ion;
            mobile.display.Size      = "320x480";
            mobile.display.Colors    = 65895;

            Console.WriteLine(mobile);
        }
        static void Main()
        {
            GSM mobile = new GSM("Samsung", "Galaxy S5360", 330, "Evgeni Velikov");

            mobile.AddCall(new Call(300));
            mobile.AddCall(new Call(4000));
            mobile.AddCall(new Call(120));

            Console.WriteLine("Total Price: {0:C}", mobile.CalculateTotalPrice());

            mobile.RemoveCall(new Call(4000));

            Console.WriteLine("Total Price After Remove: {0:C}", mobile.CalculateTotalPrice());

            mobile.RemoveAllCall();

            Console.WriteLine("Remove Total Price: {0:C}", mobile.CalculateTotalPrice());

            Console.WriteLine();

            mobile.battery.HoursIdle = 340;
            mobile.battery.HoursTalk = 12;
            mobile.battery.Model = BatteryType.Li_Ion;
            mobile.display.Size = "320x480";
            mobile.display.Colors = 65895;

            Console.WriteLine(mobile);
        }
Пример #3
0
        public static void TestCallHistory()
        {
            GSM motorola = new GSM("nexus", "Motorola", 500, "comapny phone", new Battery(BatteryType.NiCd), new Display(5, 2000));
            GSM newBrand = new GSM("SSD", "MegaHyper");

            motorola.AddCall(new Call("12/03/2015", "05:34", "0889888888", 100));
            motorola.AddCall(new Call("02.02.2012", "12:34", "0999999999", 140));
            motorola.AddCall(new Call("12.30.2012", "00:34", "0999999999", 12));
            ShowCalls(motorola.calls);
            Console.WriteLine("The Total Price is {0}", motorola.CalculateTotalPrice());
            motorola.FindAndRemoveLongestCall();
            Console.WriteLine("Longest call now removed");
            Console.WriteLine("The Total Price is {0:F2}", motorola.CalculateTotalPrice());
            motorola.ClearHistory();
            Console.WriteLine("Call history deleted");
        }
Пример #4
0
 public static decimal CalculatePrice(GSM gsm, decimal price)
 {
     return gsm.CalculateTotalPrice(price);
 }