Question: write a python code with output!!! You must write a Bus class that inherits from an existing Vehicle class vehicle. The Vehicle class has the

 write a python code with output!!! You must write a Busclass that inherits from an existing Vehicle class vehicle. The Vehicle class

write a python code with output!!!

You must write a Bus class that inherits from an existing Vehicle class vehicle. The Vehicle class has the following methods and attributes: _init_(year: Integer, model: String) - creates an instance of a vehicle given the year and model. It initializes the seats attribute to 5 and the speed attribute to 0. All these attributes are private. get year(), get_seats(), get_speed().get_model() - these are getters for these attributes set_speed() - setter for the speed. accelerate() - increases the speed by 12 up to a maximum of 180. brake() - decreases the speed by 15 down to a minimum of 0. The Van class must have the following methods and attributes: _init_(year: Integer, model: String)- the constructor must call the constructor of the superclass Vehicle; and then initialize the seats to 44. Because Buses accelerate slower than average vehicle the accelerate() method must be overwritten to increase speed by 8, up to a maximum of 120. For example: Test Result bus = Bus (year=2017, model="Volvo") 5 print(bus.get_seats) 1 bus = Bus (year=2017, model="Volvo") 0 print(bus.get_speed) bus.accelerate() bus.accelerate() bus.brake) print (bus.get_speed)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!