当前位置: 首页>>代码示例>>C#>>正文


C# GSM.DelCall方法代码示例

本文整理汇总了C#中GSM.DelCall方法的典型用法代码示例。如果您正苦于以下问题:C# GSM.DelCall方法的具体用法?C# GSM.DelCall怎么用?C# GSM.DelCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GSM的用法示例。


在下文中一共展示了GSM.DelCall方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StartTest

    public static void StartTest()
    {
        var display = new Display(3, 300);
        var battery = new Battery("S.NO.W3TT543");
        GSM addPhone = new GSM("Hero", "HTC", 100m, "4ovek", battery, display);

        DateTime time = new DateTime(2013, 1, 10, 11, 00, 00);
        string number = "08837656282";
        int duration = 60;
        addPhone.AddCall(time, number, duration);

        DateTime time1 = new DateTime(2013, 1, 10, 12, 00, 00);
        string number1 = "08957656282";
        int duration1 = 135;
        addPhone.AddCall(time1, number1, duration1);

        DateTime time2 = new DateTime(2013, 1, 10, 12, 05, 00);
        string number2 = "08957656282";
        int duration2 = 35;
        addPhone.AddCall(time2, number2, duration2);

        var callHistory = addPhone.CallHistory;
        Console.WriteLine();
        foreach (var call in callHistory)
        {
            Console.WriteLine("Call: {0}\t{1}\t{2} secconds", call.Phone, call.Time, call.Duration);
        }

        Console.WriteLine("The bill is: {0}$", addPhone.Bill(0.37m));

        callHistory = callHistory.OrderByDescending(x => x.Duration).ToList();
        addPhone.DelCall(callHistory[0]);
        Console.WriteLine("After deleting the longest call the bill is: {0}$", addPhone.Bill(0.37m));

        addPhone.ClearCallHistory();
        Console.WriteLine("Printing call history (should be empty)");
        callHistory = addPhone.CallHistory;
        foreach (var call in callHistory)
        {
            Console.WriteLine("Call: {0}\t{1}\t{2} secconds", call.Phone, call.Time, call.Duration);
        }
    }
开发者ID:damy90,项目名称:Telerik-all,代码行数:42,代码来源:GSMCallHistoryTest.cs

示例2: Main

    static void Main(string[] args)
    {
        // Task7: TestGSM
            Console.WriteLine("Task7: TestGSM");
            Display[] displays = new Display[]
            {
                new Display(6),
                new Display(5,16),
                new Display(4)
            };
            Battery[] batteries = new Battery[]
            {
                new Battery("Asenova"),
                new Battery("Ivanova",43),
                new Battery("Popova",33,44,BatteryType.Lilon),
            };
            GSM[] gsms = new GSM[]
            {
                new GSM(),
                new GSM("Nokia","Japan","Huren",batteries[0],displays[0]),
                new GSM("Newest","Modern","Stoqn",batteries[1],displays[1]),
                new GSM("Samsung","Bulgaria","Semra", batteries[2],displays[2])
            };
            foreach (var gsm in gsms)
            {
                Console.WriteLine(gsm);
                Console.WriteLine();
            }
            Console.WriteLine(GSM.Iphone4S);

            // Task12: GsmCallHistoryTest
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Task12: GsmCallHistoryTest");

            Battery gsmTwoBattery = new Battery("Toshiba", 123, 456, BatteryType.Lilon);
            Display gsmTwoDisp = new Display(33, 44);
            GSM gsmTwo = new GSM("BigWork", "MasterOne", "Huren", gsmTwoBattery, gsmTwoDisp);
            Console.WriteLine(gsmTwo);

            Battery gsmThreeBattery = new Battery("Tokio", 34244);
            Display gsmThreeDisplay = new Display(1324);
            GSM gsmThree = new GSM("Bash", "BashMaster", 5, "Hasan", gsmThreeBattery, gsmThreeDisplay,null);
            Console.WriteLine(gsmThree);

            List<Call> gsmOneCallHistory=new List<Call>();
            Call firstCallGsmOne=new Call("68-86-87",435);
            Call secondCallGsmOne=new Call("82-25-50",120);
            Call thirdCallGsmOne=new Call("82-68-77",66);

            gsmOneCallHistory.Add(firstCallGsmOne);
            gsmOneCallHistory.Add(secondCallGsmOne);
            gsmOneCallHistory.Add(thirdCallGsmOne);

            Console.WriteLine();
            GSM gsmOne=new GSM(gsmOneCallHistory);
            Call forAdd = new Call("11/77/77", 32333);
            gsmOne.AddCall(forAdd);

            foreach (var call in gsmOneCallHistory)
            {
                Console.WriteLine(call);
            }

            Console.WriteLine( gsmOne.MakeSum(0.37));

            int k = -2;
            int maxDuration = -2;
            for (int i = 0; i < gsmOneCallHistory.Count; i++)
            {
                if (gsmOneCallHistory[i].Duration > maxDuration)
                {
                    maxDuration = gsmOneCallHistory[i].Duration;
                    k = i;
                }
            }
            gsmOne.DelCall(k);
            Console.WriteLine(gsmOne.MakeSum(0.37));

            gsmOne.Clear();
            foreach (var call in gsmOneCallHistory)
            {
                Console.WriteLine(call);
            }
    }
开发者ID:stoyanovalexander,项目名称:TheRepositoryOfAlexanderStoyanov,代码行数:85,代码来源:GSMTest.cs


注:本文中的GSM.DelCall方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。