Advertisement
cuniszkiewicz

RaceCar

Mar 17th, 2025
101
0
29 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 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 RaceCar : SportsCar
  11.     {
  12.         public bool SafetyCage { get; set; }  
  13.         public string TireType { get; set; }  
  14.         public int PitStopCount { get; set; }
  15.         public bool BoostMode { get; set; }  
  16.  
  17.         public RaceCar(string _brand, string _model, string _color = "Blue",
  18.                        bool _safetyCage = true, string _tireType = "Medium")
  19.             : base(_brand, _model, _color)
  20.         {
  21.             IsSportMode = true;
  22.             SafetyCage = _safetyCage;
  23.             TireType = _tireType;
  24.             PitStopCount = 0;
  25.             BoostMode = false;
  26.         }
  27.  
  28.      
  29.         public void ActivateBoost()
  30.         {
  31.             BoostMode = true;
  32.             Console.WriteLine($"{brand} {model}: Boost Mode Activated! More power unleashed!");
  33.         }
  34.         public void PitStop()
  35.         {
  36.             PitStopCount++;
  37.             Console.WriteLine($"{brand} {model}: Pit stop completed! Total stops: {PitStopCount}");
  38.         }
  39.  
  40.        
  41.         public override void PrintCarInfo()
  42.         {
  43.             base.PrintCarInfo();
  44.             Console.WriteLine($"Cage: {SafetyCage}, Tires: {TireType}, Pit Stops: {PitStopCount}, Boost Mode: {(BoostMode ? "ON" : "OFF")}");
  45.         }
  46.     }
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement