MeGaDeTH_91

Engine

Feb 18th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. public class Engine
  6. {
  7. public string Model { get; set; }
  8. public string Power { get; set; }
  9. public string Displacement { get; set; }
  10. public string Efficiency { get; set; }
  11.  
  12. public override string ToString()
  13. {
  14. string currDispl = this.Displacement != null ? this.Displacement: "n/a";
  15. string currEff = this.Efficiency != null ? this.Efficiency : "n/a";
  16. StringBuilder sb = new StringBuilder();
  17. sb.AppendLine($" {this.Model}:");
  18. sb.AppendLine($" Power: {this.Power}");
  19. sb.AppendLine($" Displacement: {currDispl}");
  20. sb.AppendLine($" Efficiency: {currEff}");
  21. return sb.ToString().TrimEnd();
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment