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


C# GSM.AddNewCalls方法代码示例

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


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

示例1: Main

    static void Main()
    {
        //GSM Test
        //Task 7
        Console.WriteLine("Test 1:");
        GSM myGSM = new GSM("Xperia SP", "Sony");
        GSM.PrintGSMCharacteristics(myGSM);

        Console.WriteLine();
        Console.WriteLine("Test 2:");
        myGSM.Price = 330;
        myGSM.Battery.BatType = BatteryType.LiIon;
        myGSM.Battery.HoursTalk = 13;
        myGSM.Battery.Model = "AB/D-F G";
        GSM.PrintGSMCharacteristics(myGSM);

        Console.WriteLine();
        Console.WriteLine("Test 3:");
        myGSM.Display.Size = 4.3;
        myGSM.Display.NumberOfColours = 16000000;
        GSM.PrintGSMCharacteristics(myGSM);

        Console.WriteLine();
        Console.WriteLine("Test 4:");
        GSM doughtersGSM = new GSM("Desire 500", "HTC");
        doughtersGSM.Owner = "Sofi";
        doughtersGSM.Price = 230.5;
        doughtersGSM.Battery.BatType = BatteryType.NiCd;
        doughtersGSM.Battery.Model = "afaf - asfg";
        doughtersGSM.Battery.HoursTalk = 14.5;
        doughtersGSM.Battery.HoursIdle = 240;
        doughtersGSM.Display.Size = 4;
        doughtersGSM.Display.NumberOfColours = 16000000;
        GSM.PrintGSMCharacteristics(doughtersGSM);

        Console.WriteLine();
        Console.WriteLine("Test 5:");
        GSM wifeGSM = new GSM("C7", "Nokia", 350.4, "Zorka");
        wifeGSM.Display = new Display(3.6, 1000000);
        GSM.PrintGSMCharacteristics(wifeGSM);

        GSM fatherGSM = new GSM("100", "Nokia");
        fatherGSM.Battery = new Battery();

        //Task 7 - Create an array of few instances of the GSM class.
        //Display the information about the GSMs in the array.
        //Display the information about the static property IPhone4S.
        Console.WriteLine();
        Console.WriteLine("Print all GSMs from a list:");
        List<GSM> gsmList = new List<GSM> { myGSM, doughtersGSM, wifeGSM, fatherGSM };

        foreach (var item in gsmList)
        {
            GSM.PrintGSMCharacteristics(item);
            Console.WriteLine();
        }

        GSM IPhone = GSM.IPhone4S;
        GSM.PrintGSMCharacteristics(IPhone);

        //Task 12 - GSMCallHistoryTest - I decided to combine GSM Test and GSMCallHistoryTest
        Console.WriteLine();
        Console.WriteLine("Call History Test:");
        GSM testGSM = new GSM("100", "Nokia");
        Call call1 = new Call(DateTime.Now, "14:59", 132, "0888 885 654");
        Call call2 = new Call(DateTime.Now, "15:39", 112, "0888 885 456");
        Call call3 = new Call(DateTime.Now, "16:22", 32, "0888 885 564");
        Call call4 = new Call(DateTime.Now, "17:15", 12, "0888 885 444");
        Call call5 = new Call(DateTime.Now, "18:12", 145, "0888 885 444");

        testGSM.AddNewCalls(call1);
        testGSM.AddNewCalls(call2);
        testGSM.AddNewCalls(call3);
        testGSM.AddNewCalls(call4);
        testGSM.AddNewCalls(call5);

        PrintCallHistory(testGSM);

        Console.WriteLine("GSM {1} {2} - Total cost of calls-->{0:f2}", testGSM.CalculateTotalPrice(0.37),
                    testGSM.Manifacturer, testGSM.Model);

        RemoveLongestCall(testGSM);
        Console.WriteLine();

        Console.WriteLine("After deleting the longest call, total cost is {0:f2}", testGSM.CalculateTotalPrice(0.37));
        Console.WriteLine();
        testGSM.ClearCallList();
        Console.WriteLine("New call history (after clearing the list):");
        PrintCallHistory(testGSM);
    }
开发者ID:Bonevm01,项目名称:OOP_DefiningClasses1,代码行数:90,代码来源:GSMtest.cs


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