Please help me identify which is polymorphism and inheritance in the program, if none, please add. Other comments on other code blocks will be appreciated. Lastly,  display the information of the vehicle/s. Thanks lot. ————- public class Vehicle     {         public Vehicle()         { }         protected string _type;         protected int_door;         protected double _Fuelcapacity;         protected double _speed;         protected void SetType(string type)         {             // such as car, bus, motorcycle.               _type = type;         }         protected void SetEngineType(string engineType)         {             // such as diesel, regular gas, unleaded gas              _engineType = engineType;         }         public void Setdoor(int door)         {             _door = door;         }     }     public class Car : Vehicle     {         public double GetKilometrage()         {             return _speed / 0.62137;          }     }     public class Bus : Vehicle     {         private int capacity;         public int Capacity         {             get             {                 return capacity;             }             set             {                 Capacity = value;             }         }         public double Getspeed()         {             return _speed; // comes from the base class          }         public int GetCapacity()         {             return Capacity;         }     }  static void Main(string[] args)         {             Car myCar = new Car();             myCar.setspeed(25000);             Console.WriteLine(myCar.GetKilometrage().ToString());             Console.ReadKey();         }

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Please help me identify which is polymorphism and inheritance in the program, if none, please add. Other comments on other code blocks will be appreciated. Lastly,  display the information of the vehicle/s. Thanks lot.
————-
public class Vehicle
    {
        public Vehicle()
        { }
        protected string _type;
        protected int_door;
        protected double _Fuelcapacity;

        protected double _speed;
        protected void SetType(string type)
        {
            // such as car, bus, motorcycle.  
            _type = type;
        }
        protected void SetEngineType(string engineType)
        {
            // such as diesel, regular gas, unleaded gas 
            _engineType = engineType;
        }
        public void Setdoor(int door)
        {
            _door = door;
        }
    }
    public class Car : Vehicle
    {
        public double GetKilometrage()
        {
            return _speed / 0.62137; 
        }
    }
    public class Bus : Vehicle
    {
        private int capacity;
        public int Capacity
        {
            get
            {
                return capacity;
            }
            set
            {
                Capacity = value;
            }
        }
        public double Getspeed()
        {
            return _speed; // comes from the base class 
        }
        public int GetCapacity()
        {
            return Capacity;
        }
    }
 static void Main(string[] args)
        {
            Car myCar = new Car();
            myCar.setspeed(25000);
            Console.WriteLine(myCar.GetKilometrage().ToString());
            Console.ReadKey();
        }

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage