コード例 #1
0
 public static void Test()
 {
     MobileDevice phone = new MobileDevice("Alkatel", "CC");
     phone.AddCall(new Call(55, "897777000"));
     phone.AddCall(new Call(22, "062666666"));
     decimal totalPrice = phone.CalculatePrice(0.37m);
     phone.AddCall(new Call(60, "062333333"));
     phone.AddCall (new Call(160, "888888333"));
     totalPrice = phone.CalculatePrice(0.37m);
     Console.WriteLine("Price: {0:0.00}", totalPrice);
     totalPrice = phone.calculatePriceMaxOut(0.37m);
     Console.WriteLine("Price: {0:0.00}", totalPrice);
 }
コード例 #2
0
        static void Main()
        {
            MobileDevice[] deviceLot = new MobileDevice[4];
            Battery battery = new Battery(BatteryType.LiIon, BatteryColor.Grey, 100, 10);
            Display display = new Display(256000);
            deviceLot[0] = new MobileDevice("HTC", "Desire X", 429.99m, "PEshko");
            deviceLot[1] = new MobileDevice("HTC", "One", 809.99m, "Goshko");
            deviceLot[2] = new MobileDevice("Apple", "iPhoneS4", battery, display);
            deviceLot[3] = new MobileDevice("Nokia", "Lumnia");

            foreach (var device in deviceLot)
            {
                Console.WriteLine(device.ToString());
            }

            CallHistoryTest.Test();
        }