Write the coding for the following OOP base concepts.
No of wheels - integer
No of passenger - integer
Keyon - Boolean
It has methods accelerate (step) , start ( ), stop ( ), break ( ), speedometer ( ) Which can be accessed anywhere but are active when keyon = true.
a. Accelerate(step) ΓΆβ?¬β?? This method increases the speed by a step value but step value is integer ΓΆβ?¬β?? 6
b. Start ()- changes the keyOn to true.
c. Stop () ΓΆβ?¬β?? changes the keyOn to false
d. Break () ΓΆβ?¬β?? this method reduces the speed by half speed become zero.
e. Speedometer ( )- show the speed of the vehicle
f. Following method are using for gets the properties of vehicle .
getNoofwheels( ),
get Noofpassenger( ),
getEnginepower( ),
getSpeed ( ),
getKeyOn( ),
getMaxspeed( ) β?¦..
Ads