本文整理汇总了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();
}
示例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();
}
示例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));
}