本文整理汇总了C#中GSM.RemoveCallByDuration方法的典型用法代码示例。如果您正苦于以下问题:C# GSM.RemoveCallByDuration方法的具体用法?C# GSM.RemoveCallByDuration怎么用?C# GSM.RemoveCallByDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GSM
的用法示例。
在下文中一共展示了GSM.RemoveCallByDuration方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
// GSMTest
GSM[] test = new GSM[3];
Display testDisplay = new Display(12, 13);
Battery testBattery = new Battery(BatteryType.LiIon, 10, 10);
GSM firstPhone = new GSM("test", "test", 12, "Bai Ivan", testBattery, testDisplay);
test[0] = firstPhone;
GSM secondPhone = new GSM("SecondTest", "SecondTest", 14, "Moore Name", testBattery, testDisplay);
test[1] = secondPhone;
GSM thirdPhone = new GSM("Some test", "Texttt", 1, "Name", testBattery, testDisplay);
test[2] = thirdPhone;
for (int i = 0; i < test.Length; i++)
{
Console.WriteLine(test[i]);
}
Console.WriteLine(GSM.Iphone.Model);
Console.WriteLine(GSM.Iphone.Manufacturer);
Console.WriteLine(firstPhone.Battery.BatteryModel);
Console.WriteLine("---------------------------------");
Console.WriteLine("GSMCallHistoryTest");
Console.WriteLine("---------------------------------");
//GSMCallHistoryTest
GSM myPhone = new GSM("Nokia", "Nokia Corp", 1, "Ivan", testBattery, testDisplay);
myPhone.AddCall(DateTime.Now, "088888888", 236);
myPhone.AddCall(DateTime.Now, "077777777", 333);
myPhone.AddCall(DateTime.Now, "066666666", 123);
myPhone.AddCall(DateTime.Now, "055555555", 11);
myPhone.AddCall(DateTime.Now, "044444444", 23);
myPhone.DisplayCallHistory();
Console.WriteLine(myPhone.CalcPrice(0.37));
myPhone.RemoveCallByDuration(333);
myPhone.DisplayCallHistory();
Console.WriteLine(myPhone.CalcPrice(0.37));
myPhone.ClearHistory();
myPhone.DisplayCallHistory();
}
示例2: Main
static void Main()
{
//GSM Test
GSM[] mobilePhoneArray = new GSM[3];
Display testDisplay = new Display(8, 160);
Battery testBattery = new Battery(BatteryType.LiIon, 10, 10);
GSM firstMobile = new GSM("Lumia", "Nokia", 350, "Pesho", testBattery, testDisplay);
mobilePhoneArray[0] = firstMobile;
GSM secondMobile = new GSM("One", "HTC", 700, "Toshko", testBattery, testDisplay);
mobilePhoneArray[1] = secondMobile;
GSM thirdMobile = new GSM("Galaxy S3", "Samsung", 500, "Ganio", testBattery, testDisplay);
mobilePhoneArray[2] = secondMobile;
for (int i = 0; i < mobilePhoneArray.Length; i++)
{
Console.WriteLine(mobilePhoneArray[i]);
Console.WriteLine(new string('=', 17));
Console.WriteLine();
}
Console.WriteLine(GSM.Iphone.Model);
Console.WriteLine(GSM.Iphone.Manufacturer);
Console.WriteLine(GSM.Iphone.Price);
Console.WriteLine();
//GSM Call History Test
GSM myPhone = new GSM("Lumia", "Nokia", 459, "Kiro", testBattery, testDisplay);
myPhone.AddCall(DateTime.Now, "0884647523", 456);
myPhone.AddCall(DateTime.Now, "0894547579", 320);
myPhone.AddCall(DateTime.Now, "0875578923", 15);
myPhone.AddCall(DateTime.Now, "0888987051", 45);
myPhone.AddCall(DateTime.Now, "0880600700", 32);
myPhone.AddCall(DateTime.Now, "0875657258", 69);
myPhone.DisplayCallHistory();
Console.WriteLine(myPhone.CalcPrice(0.37));
myPhone.RemoveCallByDuration(456);
myPhone.DisplayCallHistory();
Console.WriteLine(myPhone.CalcPrice(0.37));
myPhone.ClearHistory();
myPhone.DisplayCallHistory();
}
示例3: Main
static void Main()
{
// GSMTest
GSM[] test = new GSM[3];
Display testDisplay = new Display(5, 65000);
Battery testBattery = new Battery(BatteryType.LiIon, 15, 20);
GSM firstPhone = new GSM("StarII", "Samsung", 120, "Pesho", testBattery, testDisplay);
test[0] = firstPhone;
Display test2Display = new Display(3, 250);
Battery test2Battery = new Battery(BatteryType.NiCd, 10, 12);
GSM secondPhone = new GSM("Desire 300", "HTC", 300, "Ivan", test2Battery, test2Display);
test[1] = secondPhone;
Display test3Display = new Display(7, 255000);
Battery test3Battery = new Battery(BatteryType.NiMH, 5, 6);
GSM thirdPhone = new GSM("Lumbia 625", "Nokia", 650, "Kalina", test3Battery, test3Display);
test[2] = thirdPhone;
for (int i = 0; i < test.Length; i++)
{
Console.WriteLine(test[i]);
}
Console.WriteLine(GSM.Iphone.Model);
Console.WriteLine(GSM.Iphone.Manufacturer);
Console.WriteLine(firstPhone.Battery.BatteryModel);
Console.WriteLine(new string('-',70));
Console.WriteLine("GSM CALL Histiry Test");
Console.WriteLine(new string('-', 70));
//GSM Call History Test
GSM myPhone = new GSM("IPhone4S", "Apple", 450, "Lili", testBattery, testDisplay);
myPhone.AddCall(DateTime.Now, "0888665533", 55);
myPhone.AddCall(DateTime.Now, "0888345678", 512);
myPhone.AddCall(DateTime.Now, "0888123456", 238);
myPhone.AddCall(DateTime.Now, "0888987654", 5);
myPhone.AddCall(DateTime.Now, "0888244668", 105);
myPhone.AddCall(DateTime.Now, "0888133557", 89);
myPhone.AddCall(DateTime.Now, "0888435465", 72);
myPhone.DisplayCallHistory();
Console.WriteLine(myPhone.CalcPrice(0.37));
myPhone.RemoveCallByDuration(105);
myPhone.DisplayCallHistory();
Console.WriteLine(myPhone.CalcPrice(0.37));
myPhone.ClearHistory();
myPhone.DisplayCallHistory();
}
示例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());
}
//
}