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


C# GSM.CalculateTotalBill方法代码示例

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


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

示例1: Main

    public static void Main()
    {
        //Console.Write("Enter number of phones: ");
        //int number = int.Parse(Console.ReadLine());
        //GSM[] phones = new GSM[number];

        //for (int i = 0; i < number; i++)
        //{
        //    Console.Write("Enter phone model: ");
        //    string model = Console.ReadLine();
        //    Console.Write("Enter phone manifacutrer: ");
        //    string manifacture = Console.ReadLine();
        //    Console.Write("Enter phone owner: ");
        //    string owner = Console.ReadLine();
        //    Console.Write("Enter phone price: ");
        //    string price = Console.ReadLine();
        //    Console.Write("Enter phone batter model: ");
        //    string batteryModel = Console.ReadLine();
        //    Console.Write("Enter phone battery idle hours: ");
        //    string idleHours = Console.ReadLine();
        //    Console.Write("Enter phone battery talk hours: ");
        //    string talkHours = Console.ReadLine();
        //    Console.Write("Enter phone display size: ");
        //    string displaySize = Console.ReadLine();
        //    Console.Write("Enter phone number of colors: ");
        //    string displayColors = Console.ReadLine();

        //    phones[i] = new GSM(model, manifacture, owner, double.Parse(price), batteryModel, int.Parse(idleHours), int.Parse(talkHours), double.Parse(displaySize), int.Parse(displayColors));
        //}

        //foreach (var item in phones)
        //{
        //    Console.WriteLine();
        //    item.GetInfo();
              //Console.WriteLine(item.ToString());
        //    Console.WriteLine();
        //}
     
     
        
        //---------------------------------------------------------------------------------------------------//
        //CallHistoryTest
        GSM mobile = new GSM("3310", "Nokia", "Some swedish guy", 100m, "ARhd34", 310, 140, 4.3f, 16000000, BatteryType.LiIon);
        Console.WriteLine(mobile.ToString());

        //mobile.GetInfo();

        mobile.AddCalls("12:50", 0894216738, 50, 21, 12, 2013);
        mobile.AddCalls("16:23", 0894216738, 120, 21, 12, 2013);
        mobile.AddCalls("18:32", 0894216738, 23, 24, 12, 2013);
        mobile.AddCalls("12:17", 0894216738, 180, 29, 12, 2013);

        //Get info for the calls
        Console.WriteLine();
        foreach (var item in mobile.callHistory)
        {
            Console.WriteLine(item.date + " " + item.dialedNumber + " " + item.duration + " " + item.Time);
        }

        //Print total price
        Console.WriteLine();
        Console.WriteLine("Total price: {0}", mobile.CalculateTotalBill(0.37m));

        //Delete longest call and print price again
        mobile.callHistory.Remove(mobile.callHistory[3]);
        
        Console.WriteLine();
        Console.WriteLine("Total price: {0}", mobile.CalculateTotalBill(0.37m));

        //Clear call history and print again
        mobile.callHistory.Clear();

        Console.WriteLine();
        foreach (var item in mobile.callHistory)
        {
            Console.WriteLine(item.date + " " + item.dialedNumber + " " + item.duration + " " + item.Time);
        }
    }
开发者ID:ScreeM92,项目名称:Software-University,代码行数:78,代码来源:GSMTest.cs


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