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


C# GSM.TotalCallPrice方法代码示例

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


在下文中一共展示了GSM.TotalCallPrice方法的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: GSMCallHistoryTest

	private static void GSMCallHistoryTest()
	{
		GSM testGSM = new GSM("Nokia", "Telerik - A Progress Company");

		testGSM.AddCall("+359873432142", 53);
		testGSM.AddCall("+359811432142", 123);
		testGSM.AddCall("+359872412142", 41);
		testGSM.AddCall("+359833332142", 72);
		testGSM.AddCall("+359614432142", 231);

		testGSM.ShowCallHistory();

		Console.WriteLine("Total call price: " + testGSM.TotalCallPrice());

		testGSM.DeleteCall(5);
		Console.WriteLine("Longest call was removed.");

		Console.WriteLine("Total call price: " + testGSM.TotalCallPrice());

		testGSM.ClearCallHistory();
		Console.WriteLine("Call history was removed.");
		testGSM.ShowCallHistory();
	}
开发者ID:GeorgiNik,项目名称:TelerikAcademy,代码行数:23,代码来源:GSMTester.cs

示例3: PrintTotalCost

 /// <summary>
 /// Prints the total price of the calls in the phone history.
 /// </summary>
 /// <param name="phone">The phone.</param>
 /// <param name="pricePerMinute">Price per minute.</param>
 public static void PrintTotalCost(GSM phone, decimal pricePerMinute)
 {
     Console.WriteLine("Total cost: ${0:F2}", phone.TotalCallPrice(pricePerMinute));
 }
开发者ID:MarKamenov,项目名称:TelerikAcademy,代码行数:9,代码来源:GSMCallHistoryTest.cs


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