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


C# GSM.ClearCalls方法代码示例

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


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

示例1: Main

    static void Main()
    {
        Battery newBattery = new Battery(BatteryType.LiIon, "ChinaBattery", 10, 10);
        Display newDisplay = new Display(4.0, 16000000);

        GSM[] gsms = new GSM[2];

        gsms[0] = new GSM("iPhone5", "Apple", 1500, "Steve Jobs", newBattery, newDisplay);
        gsms[1] = new GSM("Galaxy Ace", "Samsung", 500, "Lee Byung-chull", newBattery, newDisplay);

        Console.WriteLine(gsms[0]);
        Console.WriteLine(gsms[1]);

        Console.WriteLine("Iphone Model: {0}", GSM.IPhone4S.Model);
        Console.WriteLine("Iphone Manufacturer: {0}", GSM.IPhone4S.Manufacturer);
        Console.WriteLine("Iphone Price: {0}", GSM.IPhone4S.Price);

        //Task 12

        Console.WriteLine();
        Console.WriteLine("---------------------------------------");
        Console.WriteLine();

        GSM nokiaPhone = new GSM("C6-01", "Nokia", 400, "Nokia owner", newBattery, newDisplay);

        nokiaPhone.AddCall(DateTime.Now, 359888123456, 120);
        nokiaPhone.AddCall(DateTime.Now, 359884000000, 240);
        nokiaPhone.AddCall(DateTime.Now, 359882000000, 480);

        int longestCall = 0;
        int longestDuration = 0;
        for (int i = 0; i < nokiaPhone.CallHistory.Count; i++)
        {
            if (nokiaPhone.CallHistory[i].DurationInSeconds > longestDuration)
            {
                longestDuration = nokiaPhone.CallHistory[i].DurationInSeconds;
                longestCall = i;
            }
            Console.WriteLine("Call from {0} to {1} lasted {2} seconds", nokiaPhone.CallHistory[i].Date, nokiaPhone.CallHistory[i].DialedPhoneNumber, nokiaPhone.CallHistory[i].DurationInSeconds);
        }

        Console.WriteLine();
        Console.WriteLine("Total calls cost is {0}lv.", nokiaPhone.TotalCallPrice(0.37));

        nokiaPhone.RemoveCall(longestCall);
        Console.WriteLine("Total calls cost after deleting the longest call is {0}lv.", nokiaPhone.TotalCallPrice(0.37));
        nokiaPhone.ClearCalls();
    }
开发者ID:hristian-dimov,项目名称:TelerikAcademy,代码行数:48,代码来源:GSMTest.cs

示例2: Main

 static void Main()
 {
     GSM gsm = new GSM("Vanio", "Tanio");
        GSMTest test = new GSMTest();
        string[] models = { "Nokia", "Samsung", "Motorola" };
        string[] manafacturer = { "China", "Belarus", "Russia" };
        int[] prices = { 300, 500, 2000 };
        string[] owner = { "Gosho", "Pesho", "Vasko" };
       Console.Write(test.GsmTestInformation(models, manafacturer, prices, owner));
       Console.WriteLine(GSM.IPhone4S);
       GSMCallHistoryTest phone = new GSMCallHistoryTest();
       phone.AddTestCalls(gsm);
       gsm.PrintCalls();
       Console.Write("The total price is: ");
       Console.WriteLine(gsm.CalculatePrice(0.37m));
       phone.RemoveBiggestCall(gsm);
       Console.Write("The price after removing bigest talk: ");
       Console.WriteLine(gsm.CalculatePrice(0.37m));
       gsm.ClearCalls();
 }
开发者ID:Producenta,项目名称:TelerikAcademy,代码行数:20,代码来源:Program.cs

示例3: Test

    public void Test()
    {
        GSM myPhone = new GSM("Galaxy S3", "Samsung");

        Call call1 = new Call(60, "*88");
        Call call2 = new Call(360, "+359887123456");
        Call call3 = new Call(20, "+35921234567");

        myPhone.CallHistory.Add(call1);
        myPhone.CallHistory.Add(call2);
        myPhone.CallHistory.Add(call3);

        ulong? longestCall = ulong.MinValue;
        int callIndex = 0;

        for (int index = 0; index < myPhone.CallHistory.Count; index++)
        {
            if (myPhone.CallHistory[index].callDuration > longestCall)
            {
                callIndex = index;
                longestCall = myPhone.CallHistory[index].callDuration;
            }
        }
        foreach (var call in myPhone.CallHistory)
        {
            Console.WriteLine(call);
        }

        Console.WriteLine(myPhone.CallsPrice());

        myPhone.CallHistory.RemoveAt(callIndex);

        Console.WriteLine(myPhone.CallsPrice());

        myPhone.ClearCalls();

        Console.WriteLine(myPhone.CallsPrice());
    }
开发者ID:kalinnikol,项目名称:TelerikAcademy-3,代码行数:38,代码来源:GSMCallHistoryTest.cs


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