本文整理汇总了C#中Battery.GetBatteryInfo方法的典型用法代码示例。如果您正苦于以下问题:C# Battery.GetBatteryInfo方法的具体用法?C# Battery.GetBatteryInfo怎么用?C# Battery.GetBatteryInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Battery
的用法示例。
在下文中一共展示了Battery.GetBatteryInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPhoneInfo
public string GetPhoneInfo()
{
Console.WriteLine("Enter battery model");
string batteryModel = Console.ReadLine();
Console.WriteLine("Enter battery endurance in idle");
byte batteryHourIdle = byte.Parse(Console.ReadLine());
Console.WriteLine("Enter battery endurance in talk");
byte batteryHourTalk = byte.Parse(Console.ReadLine());
Battery battery = new Battery(batteryModel, batteryHourIdle, batteryHourTalk);
string batteryInfo = battery.GetBatteryInfo();
Console.WriteLine("Enter display size");
float displaySize = float.Parse(Console.ReadLine());
Console.WriteLine("Enter display colors");
byte displayColors = byte.Parse(Console.ReadLine());
Display display = new Display(displaySize, displayColors);
string displayInfo = display.GetDisplayInfo();
string phoneInfo = string.Format("Phone {0} {1}, owned by {2}, has\r\nprice ${3:F2}\r\nbattery: {4}\r\ndisplay: {5}",
this.manufacturer, this.model, this.owner, this.price, batteryInfo, displayInfo);
return phoneInfo;
}