本文整理汇总了C#中GSM.Print方法的典型用法代码示例。如果您正苦于以下问题:C# GSM.Print方法的具体用法?C# GSM.Print怎么用?C# GSM.Print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GSM
的用法示例。
在下文中一共展示了GSM.Print方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
GSM firstGSM = new GSM();
// USER INPUT
//Console.WriteLine("Enter phone model: ");
//firstGSM.Model = Console.ReadLine();
//Console.WriteLine("Enter manufacturer: ");
//firstGSM.Manufacturer = Console.ReadLine();
//Console.WriteLine("Enter price: ");
//firstGSM.Price = int.Parse(Console.ReadLine());
//Console.WriteLine("Enter owner: ");
//firstGSM.Owner = Console.ReadLine();
//Console.WriteLine("Enter battery model between Li-Ion,NiMH,NiCD(0-2): ");
//firstGSM.Battery.Model = (BatteryType)int.Parse(Console.ReadLine());
//Console.WriteLine("Enter hours idle: ");
//firstGSM.Battery.HoursIdle = double.Parse(Console.ReadLine());
//Console.WriteLine("Enter hours talked: ");
//firstGSM.Battery.HoursTalked = double.Parse(Console.ReadLine());
//Console.WriteLine("Enter display size: ");
//firstGSM.Display.Size = uint.Parse(Console.ReadLine());
//Console.WriteLine("Enter display colours: ");
//firstGSM.Display.Colours = uint.Parse(Console.ReadLine());
//AUTO INPUT
firstGSM.Model = "Galaxy S";
firstGSM.Manufacturer = "Samsung";
firstGSM.Price = 899;
firstGSM.Owner = "The Owner";
firstGSM.Battery.Model = BatteryType.NiCD;
firstGSM.Battery.HoursIdle = 216.5;
firstGSM.Battery.HoursTalked = 15.5;
firstGSM.Display.Size = 11;
firstGSM.Display.Colours = 65356;
firstGSM.Print();
firstGSM.Battery.Print();
firstGSM.Display.Print();
GSM newGSM = new GSM("IPhone","Apple");
newGSM.Print();
newGSM.Battery.Print();
newGSM.Display.Print();
GSM thirdGSM = new GSM("Phone", "Manufact", 106, "Over");
thirdGSM.Print();
//Create an array of few instances of the GSM class
GSM[] myGSM = new GSM[3];
myGSM[0] = new GSM("Galaxy S2", "Samsung", 750, "Nikolai");
myGSM[1] = new GSM("3110", "Nokia", 10, "Nikolai");
myGSM[2] = new GSM("N70", "Nokia", 300, "Nikolai");
//Display the information about the GSMs in the array
for (int i = 0; i < myGSM.Length; i++)
{
myGSM[i].Print();
}
Console.WriteLine();
//Display the information about the static property IPhone4S.
GSM.IPhone4S.Print();
//Assume the price per minute is fixed and is provided as a parameter.
//Assuming that the price per minute is 0.37
double pricePerMin = 0.37;
//Create an instance of the GSM class.
GSM lastGSM = new GSM("Xperia", "Nokia", 800, "Pesho");
//Add few calls.
lastGSM.AddCall("08955454521", 300);
lastGSM.AddCall("25665663663", 165);
lastGSM.AddCall("252689657954", 214);
List<Call> history = lastGSM.CallHistory;
//Display the information about the calls.
foreach (var call in history)
{
call.PrintCall();
Console.WriteLine();
}
//Calculate and print the total price of the calls in the history.
Console.WriteLine("The price for the calls is : {0}", lastGSM.CalcPrice(pricePerMin));
//Select the longest call
int maxDurationIndex = 0;
uint maxDuration = 0;
for (int i = 0; i < history.Count; i++)
{
if (history[i].Duration > maxDuration)
{
//.........这里部分代码省略.........
示例2: Main
static void Main()
{
Console.WriteLine(new string('-', 50));
Console.WriteLine("Enter information for first phone: ");
Console.WriteLine(new string('-', 50));
GSM[] array = new GSM[2];
Console.ForegroundColor = ConsoleColor.Red;
GSM firstGSM = new GSM();
firstGSM.Read();
Console.ResetColor();
Console.WriteLine();
Console.WriteLine(new string('-', 50));
Console.WriteLine("Enter information for second phone: ");
Console.WriteLine(new string('-', 50));
Console.ForegroundColor = ConsoleColor.Green;
GSM secondGSM = new GSM();
secondGSM.Read();
Console.ResetColor();
EmptySpace(4);
Console.WriteLine(new string('-', 50));
Console.WriteLine("Print information for first phone: ");
Console.WriteLine(new string('-', 50));
Console.ForegroundColor = ConsoleColor.Red;
firstGSM.Print();
Console.ResetColor();
EmptySpace(2);
Console.WriteLine(new string('-', 50));
Console.WriteLine("Print information for second phone: ");
Console.WriteLine(new string('-', 50));
Console.ForegroundColor = ConsoleColor.Green;
secondGSM.Print();
Console.ResetColor();
EmptySpace(2);
Console.WriteLine(new string('-', 50));
Console.WriteLine("Print information for IPhone4S: ");
Console.WriteLine(new string('-', 50));
Console.ForegroundColor = ConsoleColor.Blue;
GSM.IPhone4S.Print();
Console.ResetColor();
EmptySpace(4);
GSMCallHistoryTest historyTest = new GSMCallHistoryTest();
historyTest.HistoryTest();
Console.WriteLine();
}