本文整理汇总了C#中GSM.CalculateTotalPriceOfCalls方法的典型用法代码示例。如果您正苦于以下问题:C# GSM.CalculateTotalPriceOfCalls方法的具体用法?C# GSM.CalculateTotalPriceOfCalls怎么用?C# GSM.CalculateTotalPriceOfCalls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GSM
的用法示例。
在下文中一共展示了GSM.CalculateTotalPriceOfCalls方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Print
static public void Print()
{
GSM phone = new GSM("galaxy", "samsung");
string date1 = "07/07/2011 10:48:12";
string date2 = "17/03/2012 08:43:08";
string date3 = "08/06/2012 02:52:24";
Call call1 = new Call(ParseDate(date1).ToString("dd/MM/yyyy"), ParseDate(date1).ToString("hh:mm:ss"), 0898456456, 450);
Call call2 = new Call(ParseDate(date2).ToString("dd/MM/yyyy"), ParseDate(date2).ToString("hh:mm:ss"), 0898324456, 350);
Call call3 = new Call(ParseDate(date3).ToString("dd/MM/yyyy"), ParseDate(date3).ToString("hh:mm:ss"), 0898324879, 620);
Console.WriteLine(call1);
Console.WriteLine(new string('-', 20));
Console.WriteLine(call2);
Console.WriteLine(new string('-', 20));
Console.WriteLine(call3);
phone.AddCall(call1);
phone.AddCall(call2);
phone.AddCall(call3);
decimal sum = phone.CalculateTotalPriceOfCalls(phone.CallHistory);
Console.WriteLine("price of all calls in History is {0}", sum);
ulong maxDuration = 0;
int maxIndex = -1;
for (int i = 0; i < phone.CallHistory.Count; i++)
{
if (maxDuration < phone.CallHistory[i].Duration)
{
maxDuration = phone.CallHistory[i].Duration;
maxIndex = i;
}
}
phone.DeleteCall(phone.CallHistory[maxIndex]);
sum = phone.CalculateTotalPriceOfCalls(phone.CallHistory);
Console.WriteLine("price of all calls in History is {0}", sum);
phone.ClearCallHistory();
Console.WriteLine("there are {0} calls in call history", phone.CallHistory.Count);
//Console.WriteLine(call1.Date + " " + call1.Time + " " + call1.DialedNumber + " " + call1.Duration);
}