本文整理汇总了C#中GSM类的典型用法代码示例。如果您正苦于以下问题:C# GSM类的具体用法?C# GSM怎么用?C# GSM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GSM类属于命名空间,在下文中一共展示了GSM类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddTestCalls
public GSM AddTestCalls(GSM phone)
{
phone.AddCall(DateTime.Now, 3, "087612312");
phone.AddCall(DateTime.Now, 2, "089810345");
phone.AddCall(DateTime.Now, 5, "088832323");
return phone;
}
开发者ID:Producenta,项目名称:TelerikAcademy,代码行数:7,代码来源:GSMCallHistoryTest.cs
示例2: Test
public static void Test()
{
GSM[] phones = new GSM[]
{
new GSM("3310", "Nokia", 200m, "John",
new Battery("123-23AFF", BatteryType.LiIon, 24, 3),
new Display(4, 1)),
new GSM("k700i", "Sony-Ericsson", 50m, "Me",
new Battery("Ox-315F", BatteryType.Unknown, 48, 5),
new Display(4, 65000)),
new GSM("Lumnia", "Nokia"),
new GSM("iPhone", "Apple",
new Battery("aa-22", 100, 10),
new Display(8, 2000000)),
new GSM("M-35", "Siemens", 50m, "Radi predi 10 godini")
};
foreach (var gsm in phones)
{
Console.WriteLine("=========================");
Console.WriteLine(gsm);
}
Console.WriteLine("=========================");
Console.WriteLine(GSM.IPhone4S);
}
开发者ID:nikolay-spasov,项目名称:TelerikAcademy_OOP_Homeworks,代码行数:26,代码来源:GSMTest.cs
示例3: Main
static void Main()
{
GSM NokiaN92 = new GSM("Nokia", "N82", 190, "Pesho Gosho", new Battery(Battery.Type.NiCD, 150, 13.5), new Display(2.5, 2000000000));
Console.WriteLine("Add some calls...");
NokiaN92.AddCall("0892023111", 250, 2013, 2, 25, 21, 9, 3);
NokiaN92.AddCall("0892023111", 50, 2013, 2, 22, 12, 2, 30);
NokiaN92.AddCall("0892023111", 110, 2013, 1, 7, 18, 3, 12);
Console.WriteLine("Print the calls:");
foreach (var item in NokiaN92.CallHistory)
{
Console.WriteLine(item);
}
Console.WriteLine("Calculate price of calls if the price per minute is 0.37: {0}", NokiaN92.TotalCallsPrice((decimal)0.37));
Console.WriteLine("Deleting longest call duration with the method .DeleteCall(Call)");
NokiaN92.DeleteCall(NokiaN92.CallHistory[0]);
Console.WriteLine("Calculate price of calls if the price per minute is 0.37: {0}", NokiaN92.TotalCallsPrice((decimal)0.37));
Console.WriteLine("Clear the CallHistory and print it:");
NokiaN92.ClearCallHistory();
foreach (var item in NokiaN92.CallHistory)
{
Console.WriteLine(item);
}
}
开发者ID:krstan4o,项目名称:TelerikAcademy,代码行数:27,代码来源:GSMCallHistoryTest.cs
示例4: TestHistoryDisplay
public void TestHistoryDisplay()
{
GSM phone = new GSM("lala", "sumsAng", "batman", 10000.99);
DateTime date = new DateTime();
DateTime.TryParse("2.2.2013 14:34", out date);
phone.MakeCall(date, "0899999999", 3.44);
DateTime.TryParse("6.2.2013 19:34:11", out date);
phone.MakeCall(date, "0899999999", 3.44);
DateTime.TryParse("11.2.2013 12:32:59", out date);
phone.MakeCall(date, "0889666999", 9.44);
DateTime.TryParse("12.2.2013 15:30:00", out date);
phone.MakeCall(date, "0009666999", 9.44);
string expected = @"12-Feb-13 15:30:00
11-Feb-13 12:32:59
06-Feb-13 19:34:11
02-Feb-13 14:34:00
";
StringBuilder sb = new StringBuilder();
foreach (var item in phone.GetCallsByDate())
{
sb.AppendLine(item.ToString());
}
Assert.AreEqual(expected, sb.ToString());
}
开发者ID:Dyno1990,项目名称:TelerikAcademy-1,代码行数:31,代码来源:GSMHistoryTest.cs
示例5: Main
static void Main()
{
GSM gsm = new GSM("nokia", "nokiaman");
GSM gsm1 = new GSM("nokia", "nok", 9.5m);
Battery bat = new Battery("monbat", 500, 100, BatteryType.NiMH);
Display dis = new Display(null, 256);
GSM gsm2 = new GSM("erik", "erik", bat);
GSM gsm3 = new GSM("koko", "ka", dis);
Console.WriteLine(gsm.ToString());
Console.WriteLine("-----");
Console.WriteLine(gsm1.ToString());
Console.WriteLine("-----");
Console.WriteLine(gsm2.ToString());
Console.WriteLine("-----");
Console.WriteLine(gsm3.ToString());
Console.WriteLine("---------------------------");
GSM p = GSM.IPhone4S;
p.Owner = "pesho";
p.Battery = bat;
Console.WriteLine(p.ToString());
GSMCallHistoryTest.Test();
}
开发者ID:Varbanov,项目名称:TelerikAcademy,代码行数:31,代码来源:GSMTest.cs
示例6: TestRunner
public static void TestRunner()
{
// Create a few instances of the GSM class
List<GSM> mobilePhones = new List<GSM>();
// Mobile N.1
{
mobilePhones.Add(new GSM("Asha 501", "Nokia", "GLOBUL", 599.99m, new Display(3, 1250000)));
}
// Mobile N.2
{
GSM mobile = new GSM("Xperia ray", "Sony Ericsson");
mobile.Owner = "Vivacom";
mobile.Price = 250;
mobile.Battery = new Battery(Battery.Type.NiMH);
mobile.Battery.HoursTalk = 200;
mobilePhones.Add(mobile);
}
// Display information about phones in array
foreach (var phone in mobilePhones)
Console.Write(phone);
// Mobile N.3
// Display information about IPhone 4S
Console.Write(GSM.Iphone4S);
}
开发者ID:jesconsa,项目名称:Telerik-Academy,代码行数:30,代码来源:GSM-Test.cs
示例7: Main
static void Main()
{
GSM gsmTest = new GSM("Nokia", "E7");
gsmTest.Owner = "Me";
gsmTest.Price = 680;
gsmTest.battery.HoursIdle = 90f;
gsmTest.battery.Model = "BL-4";
gsmTest.battery.Type = BatteryType.NiCd;
gsmTest.battery.HoursTalk = 8.33f;
gsmTest.display.ColoursCount = 16000000;
gsmTest.display.Size = 4;
gsmTest.call.DialedNumber = "654135416516";
gsmTest.call.DurationInSeconds = 123;
gsmTest.AddCall(new Call("number+3590000", 120));
gsmTest.AddCall(new Call("number+3590001", 25));
gsmTest.AddCall(new Call("number+3590002", 0));
// gsmTest.PrintSpecs();
Console.WriteLine(gsmTest.ToString());
//
Console.WriteLine(gsmTest.call.DurationInSeconds);
// gsmTest.DeleteCall(1);
// gsmTest.ClearCall();
for (int i = 0; i < gsmTest.CallHistory.Count; i++)
{
Console.WriteLine(gsmTest.CallHistory[i].DurationInSeconds);
}
Console.WriteLine("Total price of the call on phone {0} {1} is : {2}", gsmTest.Manufacturer, gsmTest.Model, gsmTest.GetTotalPriceOfCalls(0.18, gsmTest));
Console.WriteLine(GSM.Iphone4S.battery.Model);
// Console.WriteLine(gsmTest.call.DurationInSeconds);
}
开发者ID:prestress,项目名称:Telerik_Academy_Homework_Projects,代码行数:33,代码来源:Test.cs
示例8: Main
static void Main()
{
GSM[] mobilePhones = new GSM[3];
GSM nokia = new GSM("3310", "Nokia");
nokia.AddHistory(DateTime.Now, 0998080907, 1.08);
nokia.AddHistory(DateTime.Now, 0998080907, 2132331.08);
nokia.DeleteHistory(1);
Battery sonyBattery5511 = new Battery("77ds7", 220, 10, BatteryType.NiMH);
Display sonyDisplay5511 = new Display(23, 128);
GSM sony = new GSM("5511", "Sony", 100.77m, "Pesho", sonyBattery5511, sonyDisplay5511);
GSM samsung = new GSM("4433", "samsung", 50.22m, "Gosho");
mobilePhones[0] = nokia;
mobilePhones[1] = sony;
mobilePhones[2] = samsung;
//Console.WriteLine(nokia.CalcPriceHistory(2.2m));
for (int i = 0; i < mobilePhones.Length; i++)
{
Console.WriteLine(mobilePhones[i]);
}
}
开发者ID:siropo,项目名称:Telerik_academy_homework,代码行数:26,代码来源:GMSTest.cs
示例9: Main
static void Main(string[] args)
{
try
{
//Create battery and display for the GSM
Battery battery = new Battery("BL-5C",360,7,Battery.BatteryType.LithiumLon);
Display display = new Display(3,65536);
//Create GSM
GSM gsm = new GSM("1208", "nokia", 50, "Georgi", battery, display);
//Console.WriteLine(gsm.ToString()); //Print GSM data
//Mace some calls and print the history
gsm.AddCall(new Call(new DateTime(2013, 02, 22, 19, 01, 22), "00359888888888", 200));
gsm.AddCall(new Call(new DateTime(2013,02,22,20,02,33),"0887888888",302));
gsm.AddCall(new Call(new DateTime(2013, 02, 22, 20, 30, 19), "0889-88-88-88", 178));
gsm.PrintCallHistiry();
//Calculate the price of all calls
decimal price = 0.37m;
gsm.CalculateTotalCallsPrice(price);
//Remove the longest call and calculate the price again
gsm.DeleteCall(1); //The calls in the list start from 0, so the second call(longest) is 1
gsm.CalculateTotalCallsPrice(price);
//Clear the history and print it
gsm.ClearCallHistory();
gsm.PrintCallHistiry();
}
catch (Exception ex)
{
Console.WriteLine("Error!"+ex.Message);
}
}
开发者ID:Jarolim,项目名称:TelerikAcademy-1,代码行数:35,代码来源:GSMCallHistoryTest(Main).cs
示例10: Main
static void Main(string[] args)
{
GSM[] gsmArray = new GSM[3];
Battery myBattery = new Battery("Nokia", 50,50, BatteryType.LiIon);
Display myDisplay = new Display(10, 1000000);
GSM firstGsm = new GSM("N8", "Nokia", 500, "Me", myBattery, myDisplay);
gsmArray[0] = firstGsm;
myBattery = new Battery("Samsung", 60, 60, BatteryType.NiCd);
myDisplay = new Display(12, 1200000);
GSM secondGsm = new GSM("Galaxy", "Samsung", 700, "Me", myBattery, myDisplay);
gsmArray[1] = secondGsm;
myBattery = new Battery("HTC", 40, 40, BatteryType.NiMH);
myDisplay = new Display(8, 800000);
GSM thirdGsm = new GSM("K8", "HTC", 450, "Me", myBattery, myDisplay);
gsmArray[2] = thirdGsm;
foreach (var item in gsmArray)
{
Console.WriteLine(item);
Console.WriteLine();
}
Console.WriteLine(GSM.IPhone4S);
GSMCallHistoryTest.Test();
}
开发者ID:kalinnikol,项目名称:TelerikAcademy-1,代码行数:28,代码来源:GSMTest.cs
示例11: Main
static void Main()
{
GSM[] gsmArr = new GSM[3];
string[] gsmModelArr = { "N90","5800","N70"};
string[] gsmManufacturerArr = { "Nokia","HTC","Samsung"};
decimal[] gsmPriceArr = { 1000m, 200.34m, 2000.3434m};
string[] gsmOwnerArr = { "IBot","IDummy","IWorm"};
for (int i = 0; i < gsmArr.Length; i++)
{
gsmArr[i] = new GSM(gsmModelArr[i], gsmManufacturerArr[i], gsmPriceArr[i], gsmOwnerArr[i]);
Console.WriteLine("Override ToString(): ");
Console.WriteLine(gsmArr[i].ToString());
Console.WriteLine(gsmModelArr[i]);
Console.WriteLine(gsmManufacturerArr[i]);
Console.WriteLine(gsmPriceArr[i]);
Console.WriteLine(gsmOwnerArr[i]);
}
GSM iphone = new GSM(null,null);
iphone.iPhone4s.PhoneManufacturer = "Apple Corp.";
iphone.iPhone4s.PhoneModel = "iPhone 4 S";
Console.WriteLine(iphone.iPhone4s.PhoneManufacturer);
Console.WriteLine(iphone.iPhone4s.PhoneModel);
}
开发者ID:ekostadinov,项目名称:MyProjects,代码行数:27,代码来源:SomeGSMTesting.cs
示例12: HistoryTest
public void HistoryTest()
{
Console.WriteLine(new string('-', 50));
Console.WriteLine(" Calls history");
Console.WriteLine(new string('-', 50));
Console.WriteLine();
GSM phone = new GSM();
phone.AddHistory(DateTime.Now, "0891234567", 10);
phone.AddHistory(DateTime.Now, "0883456789", 47.99);
phone.AddHistory(DateTime.Now, "0872345678", 89.01);
phone.PrintCalls();
Console.WriteLine();
Console.WriteLine("Assuming the price per minute is 0.37! Calculate the total price of the calls:");
Console.WriteLine(new string('-', 77));
phone.CalculateTotalPrice();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Delete longest call from the history and calculate the total price again:");
Console.WriteLine(new string('-', 74));
phone.DeleteHistory(89.01);
phone.CalculateTotalPrice();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine(new string('-', 50));
Console.WriteLine(" Calls history after delete");
Console.WriteLine(new string('-', 50));
Console.WriteLine();
phone.ClearHistory();
phone.CalculateTotalPrice();
}
开发者ID:Nikolay-D,项目名称:TelerikSchoolAcademy,代码行数:33,代码来源:GSMCallHistoryTest.cs
示例13: Main
static void Main(string[] args)
{
// GSM 1
GSM nokia = new GSM("Nokia", "Nokia", 15, "Nokia");
// Add Calls
Call c1 = new Call("11/14/2001","14:27:36","+123456",900);
Call c2 = new Call("11/19/2001","14:56:36","+359883442324",800);
Call c3 = new Call("11/19/2001","12:27:36","+359883442324",800);
nokia.AddCall(c1);
nokia.AddCall(c2);
nokia.AddCall(c3);
// Display Calls Info
nokia.PrintCallHistory();
// Display Total Price of All Calls
Console.WriteLine("Total Price of All Calls:{0:C2}", nokia.CallsTotalPrice(0.37m));
// Remove Call
nokia.RemoveCall(c1);
Console.WriteLine("Total Price of All Calls:{0:C2}", nokia.CallsTotalPrice(0.37m));
// Clear Call History
nokia.RemoveAllCalls();
nokia.PrintCallHistory();
}
开发者ID:nikimoto,项目名称:thegodmode.github.com,代码行数:25,代码来源:CallHistoryTest.cs
示例14: Main
//test the call history functionality
static void Main()
{
//Create a new mobile phone
GSM mobile = new GSM("Xperia", "Sony", 670.99, "Kitty");
//Get information about created mobile phone
mobile.ToString();
//Get information about static field iPhone
GSM.IPhone4S.ToString();
//Add calls and print
mobile.AddCalls(DateTime.Now, "+359 885 440 340", 1);
mobile.AddCalls(DateTime.Now, "+359 886 789 451", 94);
mobile.PrintCalls();
//Delete call and print
mobile.DeleteCalls(2);
mobile.PrintCalls();
//Calculate total price
mobile.CalculateFinalPrice(0.35);
//Clear calls and print
mobile.ClearCalls();
}
开发者ID:deskuuu,项目名称:TelerikAcademy,代码行数:27,代码来源:StartUp.cs
示例15: Main
static void Main()
{
Console.WriteLine("GSM instances test");
Console.WriteLine(new string('-', 30));
//creates array with GSM instances
var gsms = new GSM[]
{
new GSM("Galaxy S3","Samsung"),
new GSM("G2 Mini", "LG", 190, new Battery("2440 mAh", 700, 12, Battery.Type.LiIon), new Display(540, 960, 16000000), "Martin"),
new GSM("Nexus 6", "Motorola", new Display(1440, 2560)),
new GSM("One M9", "HTC", 500, new Battery("Non-removable 2840 mAh", 391, 25), new Display(1080, 1920, 160000000))
};
//displays the information about the GSMs in the array
foreach (var gsm in gsms)
{
Console.WriteLine(gsm.ToString());
}
//displays the information about the static property IPhone4S
Console.WriteLine("Information about iPhone 4S: ");
Console.WriteLine(new string('-', 30));
Console.WriteLine(GSM.IPhone4S);
//tests calls
GSMCallHistoryTest.CallHistoryTest();
}
开发者ID:Vyara,项目名称:Telerik-Academy,代码行数:27,代码来源:GSMTest.cs
示例16: GSMWithAllDetails
public void GSMWithAllDetails()
{
Display someDisplay = new Display(45000,new DisplaySize(1024,768));
Battery superBattery = new Battery("kon",1000,1000,BatteryType.NiMH);
GSM megaPhone = new GSM("Super Phone", "Krypton", 750,someDisplay,superBattery);
Console.WriteLine(megaPhone);
}
开发者ID:ilkodzhambazov,项目名称:Telerik-Academy,代码行数:7,代码来源:GSMTest.cs
示例17: CreateFewGSMInstances
public void CreateFewGSMInstances()
{
instancesArray[0] = new GSM("3100", "Nokia", 120, "John Doe");
instancesArray[1] = new GSM("W175", "Motorola", 10);
instancesArray[2] = new GSM("5", "IPhone", "Johnny Retard");
instancesArray[3] = new GSM("50", "IPhone");
}
开发者ID:vassil,项目名称:CSharp,代码行数:7,代码来源:GSMUnitTest.cs
示例18: Main
static void Main()
{
Console.OutputEncoding = System.Text.Encoding.Unicode;
GSM myPhone = new GSM("3310", "Nokia", 1000M, "Ivan", new Display(1740, 33480, 160000000), new Battery("PK15", 50000, 2000, BatteryType.LiPol));
myPhone.AddCall("08999333888", DateTime.Now, 200);
myPhone.AddCall("08999333888", DateTime.Now, 300);
myPhone.AddCall("08888333888", DateTime.Now, 400);
myPhone.AddCall("08888333888", DateTime.Now, 500);
myPhone.AddCall("09999999999", DateTime.Now, 1);
myPhone.AddCall("08888555555", DateTime.Now, 200);
myPhone.AddCall("08888555555", DateTime.Now, 300);
myPhone.AddCall("08888555555", DateTime.Now, 400);
myPhone.AddCall("08888555555", DateTime.Now, 10101);
Console.WriteLine(myPhone.ShowCallHistory());
Console.WriteLine("Total call price: {0:C2}", myPhone.TotalCallPrice(0.37M));
myPhone.DeleteLongestCall();
myPhone.DeleteShortestCall();
myPhone.DeleteCall(3);
Console.WriteLine(new string('*', 50));
Console.WriteLine(myPhone.ShowCallHistory());
myPhone.ClearCallHistory();
Console.WriteLine(new string('*', 50));
Console.WriteLine(myPhone.ShowCallHistory());
}
开发者ID:MihailGochev,项目名称:Telerik,代码行数:31,代码来源:GSMCallHistoryTest+.cs
示例19: Main
static void Main(string[] args)
{
GSM[] phones = new GSM[]
{
new GSM("Glaxy S4", "Samsung", 899.99m,
"Tsvetomir", new Battery("Samsung", BatteryType.LiIon,
8, 40), new Display(5.0f, 16000000)),
new GSM("Glaxy S4", "Samsung", 599.99m,
"Jack", new Battery("HTC", BatteryType.NiCd,
8, 40), new Display(5.0f, 16000000)),
new GSM("Grand X", "ZTE", 199.99m,
"John", new Battery("Samsung", BatteryType.NiMH,
8, 40), new Display(4.0f, 160000))
};
foreach (var gsm in phones)
{
Console.WriteLine(gsm.ToString());
Console.WriteLine();
}
Console.WriteLine(GSM.Iphone4S.ToString());
Console.WriteLine();
GSM newGsm = new GSM("Glaxy S4", "Samsung", 899.99m,
"Tsvetomir", new Battery("Samsung", BatteryType.LiIon,
8, 40), new Display(5.0f, 16000000));
newGsm.AddCallToHistory(new Call(DateTime.Now, "08899288329", 220));
newGsm.AddCallToHistory(new Call(DateTime.Now, "09921299218", 498));
decimal totalPrice = newGsm.CalculateTotalPriceOfCalls(3.47m);
Console.WriteLine("Total price: {0}", totalPrice);
}
开发者ID:Tsvetomir-Kirchev,项目名称:Telerik-Academy-Exercises,代码行数:31,代码来源:GSMTest.cs
示例20: TestGSM
public static void TestGSM()
{
GSM[] gsms = new GSM[4];
GSM gsm = new GSM("Samsung Galaxy S Duos S7582", "Samsung", 100M,
new Battery(BatteryTypes.LiIon, 310, 8), new Display(4, 16 * 1024));
gsms[0] = gsm;
gsm = new GSM("Samsung E1200", "Samsung", 15M,
new Battery(BatteryTypes.LiIon, 720, 7), new Display(1.52, 65));
gsms[1] = gsm;
gsm = new GSM("Samsung E2202", "Samsung", 35M);
gsms[2] = gsm;
gsm = new GSM("ALCATEL ONETOUCH 1046", "Alcatel");
gsms[3] = gsm;
for (int i = 0; i < gsms.Length; i++)
{
Console.WriteLine(gsms[i]);
Console.WriteLine();
}
Console.WriteLine(GSM.IPhone4S);
}
开发者ID:ValMomchilova,项目名称:TelerikAcademyHomeWorks,代码行数:30,代码来源:GSMTest.cs
注:本文中的GSM类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论