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


C# GSM.CalcPriceOfCalls方法代码示例

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


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

示例1: Main

    static void Main()
    {
        GSM nokia = new GSM("N73", "Nokia", "Pesho", 360,
            new Battery("BP-6M", 370, 6, BatteryType.LiIon), new Display(2.4, 243000));

        GSM samsung = new GSM("GalaxyS III", "Samsung", "Gosho", 819,
            new Battery("HR32", 790, 50, BatteryType.LiIon), new Display(4.8, 16000000));

        GSM sonyEricsson = new GSM("Xperia Z", "Sony Ericsson", "Kiro", 864,
            new Battery("PM63", 550, 40, BatteryType.LiIon), new Display(5, 16000000));

        GSM vertu = new GSM("Ascent", "Vertu", "Dimcho", 10400,
            new Battery("RP-M4", 150, 4, BatteryType.LiIon), new Display(0.87, 6));

        GSM[] mobilePhones = { nokia, samsung, sonyEricsson, vertu, GSM.IPhone4S };

        foreach (var phone in mobilePhones)
        {
            Console.WriteLine(phone);
            Console.WriteLine("------------------------------");
        }

        Call callOne = new Call("0885131618", 125);
        Call callTwo = new Call("0886933601", 563);
        Call callThree = new Call("0886948266", 256);

        vertu.AddCall(callOne);
        vertu.AddCall(callTwo);
        vertu.AddCall(callThree);

        Console.WriteLine("Total price of all calls: {0}", vertu.CalcPriceOfCalls(0.37));

        double maxDuration = 0;
        string number = "";

        foreach (var call in vertu.CallHistory)
        {
            if (maxDuration < call.Duration)
            {
                maxDuration = call.Duration;
                number = call.DialedPhoneNumber;
            }
        }

        Call longestCall = new Call(number, maxDuration);

        Console.WriteLine("The longest call lasted {0} seconds and it is made with number {1}.", maxDuration, number);
        vertu.DeleteCall(longestCall);
        Console.WriteLine("Now the longest call is removed from the call history.");
        Console.WriteLine("New total price of all calls: {0}", vertu.CalcPriceOfCalls(0.37));
        vertu.ClearCallHistory();
        Console.WriteLine("Call history is now cleared!!!");
    }
开发者ID:powerslider,项目名称:TelerikAcademyHomeworks,代码行数:53,代码来源:GSMTest.cs


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