Advertisement
cuniszkiewicz

SportsCar

Mar 17th, 2025
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace OOP_first_class
  9. {
  10.     internal class SportsCar:Car
  11.     {
  12.         public bool IsSportMode { get; set; }
  13.         public double Acceleration { get; set; }
  14.         public string AerodynamicsLevel { get; set; }
  15.  
  16.         public SportsCar()  
  17.         {
  18.             Acceleration = 3;
  19.             AerodynamicsLevel = "High";
  20.             IsSportMode = false;
  21.         }
  22.  
  23.         public SportsCar(string _brand, string _model, string _color = "Black"): base (_brand, _model, _color)
  24.         {
  25.             Acceleration = 3;
  26.             AerodynamicsLevel = "High";
  27.             IsSportMode = false;
  28.         }
  29.         public void ActivateSportMode()
  30.         {
  31.             IsSportMode = true;
  32.             Console.WriteLine($"{brand} {model}: Sport Mode Activated!");
  33.         }
  34.  
  35.         public override void PrintCarInfo()
  36.         {
  37.             base.PrintCarInfo();
  38.             Console.WriteLine($"Acceleration: 0-100 km/h in {Acceleration}s, Aerodynamics: {AerodynamicsLevel}, Sport Mode: {(IsSportMode ? "ON" : "OFF")}");
  39.         }
  40.     }
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement