本文整理汇总了C#中GSM.MakeCall方法的典型用法代码示例。如果您正苦于以下问题:C# GSM.MakeCall方法的具体用法?C# GSM.MakeCall怎么用?C# GSM.MakeCall使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GSM
的用法示例。
在下文中一共展示了GSM.MakeCall方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
GSM phone = new GSM("lala", "sumsAng", "batman", 10000.99);
phone.MakeCall(DateTime.Now, "0899999999", 3.44);
phone.MakeCall(DateTime.Now.AddHours(3), "0899999999", 3.44);
phone.MakeCall(DateTime.Now.AddDays(99), "0889666999", 9.44);
phone.MakeCall(DateTime.Now.AddDays(5).AddHours(10), "0009666999", 9.44);
Console.WriteLine("Calls ordered by date: ");
foreach (DateTime timeOfCall in phone.GetCallsByDate())
{
Console.WriteLine(timeOfCall.ToString());
}
phone.DeleteCall(2);
Console.WriteLine("New calls: ");
foreach (DateTime timeOfCall in phone.GetCallsByDate())
{
Console.WriteLine(timeOfCall.ToString());
}
phone.ClearCallHistory();
Console.WriteLine("\nNothing will show, because history is deleted: ");
foreach (DateTime timeOfCall in phone.GetCallsByDate())
{
Console.WriteLine(timeOfCall.ToString());
}
}
示例2: Main
static void Main(string[] args)
{
GSM phone = new GSM("lala", "sumsAng", "batman", 10000.99);
phone.MakeCall(DateTime.Now, "0899999999", 3.44);
phone.MakeCall(DateTime.Now.AddHours(3), "0899999999", 3.44);
phone.MakeCall(DateTime.Now.AddDays(99), "0889666999", 9.44);
phone.MakeCall(DateTime.Now.AddDays(5).AddHours(10), "0009666999", 9.44);
Console.WriteLine("Calls ordered by date: ");
foreach (DateTime timeOfCall in phone.GetCallsByDate())
{
Console.WriteLine(timeOfCall.ToString());
}
}
示例3: Main
static void Main(string[] args)
{
GSM phone = new GSM("lala", "sumsAng", "batman", 10000.99);
phone.MakeCall(DateTime.Now, "0899999999", 3.44);
Console.WriteLine(phone.ShowCall().ToString());
}
示例4: Main
static void Main()
{
//Test task 4
GSM iPhone = new GSM("iPhone4s", "Apple");
//Console.WriteLine(iPhone.ToString());
//Task 7
GSM[] phoneStore = new GSM[]
{
new GSM("N95","Nokia",123, "nobody", new Battery("1200",105,43), new Display(8d,16000000)),
new GSM("X200","Samsung"),
new GSM("eXperia","Sony",500)
};
//Sell a phone to Bai Pesho
phoneStore[0].Owner = "Bai Pesho";
// Console.WriteLine("Phones in Store:");
foreach (var phone in phoneStore)
{
//Console.WriteLine(phone);
}
//Console.WriteLine(GSM.IPhone4S);
GSM workPhone = new GSM("210", "Huavei", 5, "worker");
workPhone.MakeCall(883555555, 150);
workPhone.MakeCall(883556555, 190);
workPhone.MakeCall(883566645, 212);
foreach (var call in workPhone.CallHistory)
{
Console.WriteLine("Call to {0}, duration: {1}",call.PhoneNumber,call.CallDuration);
}
//Print Total Cost
Console.WriteLine("Total Cost: " + workPhone.CalculateTotalPrice(0.37m));
//Find and remove longest call
;
ulong maxDuration = ulong.MinValue;
foreach (var call in workPhone.CallHistory)
{
if (call.CallDuration>maxDuration)
{
maxDuration = call.CallDuration;
}
}
if (maxDuration != ulong.MinValue)
{
workPhone.RemoveCallByDuration(maxDuration);
Console.WriteLine();
Console.WriteLine("Removed call with duration: " + maxDuration);
}
//Print Total Cost without longest duration
Console.WriteLine("Total Cost: " + workPhone.CalculateTotalPrice(0.37m));
Console.WriteLine();
foreach (var call in workPhone.CallHistory)
{
Console.WriteLine(call.ToString());
}
workPhone.ClearCallHistory();
//Print again
Console.WriteLine("Call History: ");
foreach (var call in workPhone.CallHistory)
{
Console.WriteLine(call.ToString());
}
//
}