public override string ToString() { StringBuilder mobileInfo = new StringBuilder(); mobileInfo.AppendLine("-------- MOBILE --------"); mobileInfo.AppendLine("Model: " + this.model); mobileInfo.AppendLine("Manufacturer: " + this.manufacturer); if (this.owner != null) { mobileInfo.AppendLine("Owner: " + this.owner); } if (this.price.HasValue) { mobileInfo.AppendLine(string.Format("Price: {0}$", this.price)); } if (this.display != null) { mobileInfo.AppendLine(Environment.NewLine + display.ToString()); } if (this.battery != null) { mobileInfo.AppendLine((display != null ? "" : Environment.NewLine) + battery.ToString()); } return(mobileInfo.ToString()); }
public string Description() { var descriptionBuilder = new StringBuilder(); descriptionBuilder.AppendLine($"Screen Type: {Screen.ToString()} ({Screen.Width}X{Screen.Height})"); descriptionBuilder.AppendLine($"Battery Type: {Battery.ToString()} ({Battery.Capacity} mAh; {Battery.Voltage} V; {Battery.ChargeLevel} %)"); descriptionBuilder.AppendLine($"CPU Type: {CPU.ToString()} ({CPU.Name}; {CPU.Frequency} GHz; {CPU.Cores} cores)"); return(descriptionBuilder.ToString()); }
public string GetDescription() { var descriptionBuilder = new StringBuilder(); descriptionBuilder.AppendLine($"Screen Type: {Screen.ToString()}"); descriptionBuilder.AppendLine($"Microphone Type: {Microphone.ToString()}"); descriptionBuilder.AppendLine($"Battery Type: {Battery.ToString()}"); descriptionBuilder.AppendLine($"Speaker Type: {Speaker.ToString()}"); descriptionBuilder.AppendLine($"SimCard Type: {SimCard.ToString()}"); return(descriptionBuilder.ToString()); }
public string GetDescription() { var descriptionBuilder = new StringBuilder(); descriptionBuilder.AppendLine($"Screen Type: {Screen.ToString()}"); descriptionBuilder.AppendLine($"Microphone Type: {Microphone.ToString()}"); descriptionBuilder.AppendLine($"Battery Type: {Battery.ToString()}"); descriptionBuilder.AppendLine($"Speaker Type: {Speaker.ToString()}"); descriptionBuilder.AppendLine($"SimCard Type: {SimCard.ToString()}"); descriptionBuilder.AppendLine($"AudioJack Type: {PlaybackComponent?.ToString() ?? "AudioJack is not set"}"); descriptionBuilder.AppendLine($"Charger Type: {ChargerComponent?.ToString() ?? "Charger is not set"}"); return(descriptionBuilder.ToString()); }
public string Description() { var descriptionBuilder = new StringBuilder(); descriptionBuilder.AppendLine($"Screen Type:\n{Screen.ToString()}"); descriptionBuilder.AppendLine($"Display Parameters:\n{Display.ToString()}"); descriptionBuilder.AppendLine($"Keyboard parmeters:\n{Keyboard.ToString()}"); descriptionBuilder.AppendLine($"Battery parameters:\n{Battery.ToString()}"); // descriptionBuilder.AppendLine($"SimCard parameters:\n{SimCard.ToString()}"); //remains form lab1 descriptionBuilder.AppendLine($"Operating system parameters:\n{OperatingSystem.ToString()}"); descriptionBuilder.AppendLine($"Camera parameters:\n{Camera.ToString()}"); descriptionBuilder.AppendLine("===================================================================="); return(descriptionBuilder.ToString()); }
public override string ToString() { return(String.Format("Brand: {0}\r\n" + "Manufacturer: {1}\r\n" + "Battery:\r\n{2}\r\n" + "Display:\r\n{3}\r\n" + "Price: {4}\r\n" + "Owner: {5}", brand, ManufacturerToString(manufacturer), battery == null ? "[no battery specified]" : battery.ToString(), display == null ? "[no display specified]" : display.ToString(), price.HasValue ? price.Value.ToString("C2", CultureInfo.GetCultureInfo("en-US")) : "[no price specified]", owner)); }