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


C# GSM.PrintHistory方法代码示例

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


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

示例1: CallsInfo

    private static void CallsInfo()
    {
        // 12. Test the call history functionality of the GSM class.
        GSM gsm = new GSM("Optimus", "LG"); // 12.1 Create an instance of the GSM class.

        // 12.2 Add few calls.
        gsm.AddCall(DateTime.Now, 0871111111, 60);
        gsm.AddCall(DateTime.Now, 0882222222, 200);
        gsm.AddCall(DateTime.Now, 0893333333, 1234);

        // 12.3 Display the information about the calls.
        gsm.PrintHistory();

        /* 12.4 Assuming that the price per minute is 0.37
                Calculate and print the total price of the calls in the history. */
        Console.WriteLine("The cost of calls is: {0:C2}", gsm.CallPrice(0.37f));

        // 12.5 Remove the longest call from the history and calculate the total price again.
        gsm.DeleteCall(1234);
        Console.WriteLine("The cost of calls without the longest one is: {0:C2}", gsm.CallPrice(0.37f));

        // 12.6 Finally clear the call history and print it.
        gsm.ClearHistory();
        gsm.PrintHistory();
        Console.WriteLine("History is cleared!" + Environment.NewLine);

        Main();
    }
开发者ID:unbelt,项目名称:Telerik,代码行数:28,代码来源:GSMTest.cs

示例2: Main

    static void Main()
    {
        // just some sample tests

        GSM tel = new GSM("Nokia", "gosho tupoto", owner: "Pesho");
        tel.AddCall("0885032502", new DateTime(2003, 2, 1), new TimeSpan(0, 10, 15));
        tel.AddCall("0883456782", new DateTime(2003, 2, 1), new TimeSpan(0, 20, 15));
        tel.AddCall("+359885032548", new DateTime(2003, 2, 1), new TimeSpan(0, 10, 15));
        tel.AddCall("+359885032576", new DateTime(2003, 2, 1), new TimeSpan(0, 15, 15));
        Console.WriteLine(tel.GetCost(0.37));
        tel.RemoveCall();
        tel.PrintHistory();
        Console.WriteLine(tel.GetCost(0.37));
        tel.ClearHistory();
        tel.PrintHistory();
        Console.WriteLine(tel + "\n\n\n");

        // IPhone test

        Console.WriteLine(GSM.IPhone4S);
    }
开发者ID:tddold,项目名称:Telerik-Academy-Homework-Solutions,代码行数:21,代码来源:Test.cs


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