Question: Exercise Overview: You will create a base class for a vehicle and extend it to represent specific types of vehicles, applying inheritance and encapsulation principles.
Exercise Overview:
You will create a base class for a vehicle and extend it to represent specific types of
vehicles, applying inheritance and encapsulation principles.
Task : Create the Vehicle Base Class Marks
Attributes:
String make
String model
int year
int speed
Methods:
A constructor to initialize make, model, and year.
A method accelerate that increases the speed by
A method brake that decreases the speed by ensure the speed does not go below
A method displayInfo that prints the vehicle's make, model, year, and current speed.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
