vishalpattnaik / Java-OOPS-Challenge-Polymorphism

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Polymorphism Challenge

Create a base class called Car. It should have a few fields that would be appropriate for a generic car class. For example, engine, cylinders, wheels, etc. Constructor should initialize cylinders (number of) and name, and set wheels to 4 and engine to true. Cylinders and names would be passed parameters. Create appropriate getters. Create some methods like startEngine, accelerate, and brake show a message for each in the base class. Now create 3 sub classes for your favourite vehicles. Override the appropriate methods to demonstrate polymorphism in use.

About


Languages

Language:Java 100.0%