Question: Create a superclass called Vehicle for your MyCar class and MyTruck class. Create a constant in your subclasses that stores information about the subclass. Let
Create a superclass called Vehicle for your MyCar class and MyTruck class. Create a constant in your subclasses that stores information about the subclass. Let the constant that is common to the MyCar class and MyTruck class is NUMEROFDOORS. Your superclass should be able to keep track of the number of objects created that inherit from the superclass. Create a method to print out the value of this class variable as well. a Let that variable be numberofvehicles b You need to define instance variables; year, model, color, and currentspeed c Currentspeed should be set to zero at the time of creation of the object. d Other variables can be initialized at the time of creation of the object e You need to define a function speedupnumber that will increase the speed of the vehicle by the amount number
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
