• Have any questions?
  • +91-9828671065
  • support@helpinhomework.org
trustpilot ratings
google ratings


Homework answers / question archive / Create a class called "Vehicle" and add methods that allow you to set the "Make", "Model", "Year,", and "Weight"

Create a class called "Vehicle" and add methods that allow you to set the "Make", "Model", "Year,", and "Weight"

Management

Create a class called "Vehicle" and add methods that allow you to set the "Make", "Model", "Year,", and "Weight".
The class should also contain a "NeedsMaintenance" boolean that defaults to False, and and "TripsSinceMaintenance" Integer that defaults to 0.
Next create a subclass that inherits the properties of Vehicle class. Call this new subclass "Cars".

The Cars class should contain a method called "Drive" that sets the state of a boolean isDriving to True. It should have another method called "Stop" that sets the value of isDriving to false.
Switching isDriving from true to false should increment the "TripsSinceMaintenance" counter. And when TripsSinceMaintenance exceeds 100, then the NeedsMaintenance boolean should be set to true.
Add a "Repair" method to either class that resets the TripsSinceMaintenance to zero, and NeedsMaintenance to false.
Create 3 different cars, using your Cars class, and drive them all a different number of times. Then print out their values for Make, Model, Year, Weight, NeedsMaintenance, and TripsSinceMaintenance
Create a Planes class that is also a subclass of Vehicle. Add methods to the Planes class for Flying and Landing (similar to Driving and Stopping), but different in one respect: Once the NeedsMaintenance boolean gets set to true, any attempt at flight should be rejected (return false), and an error message should be printed saying that the plane can't fly until it's repaired.

Fill The Details Below To Receive Instant

HOMEWORK HELP

EST
USD
Please upload other supplement files here if available.

Your question has been submitted. If you do not receive email confirmation, please contact us via email or whatsapp +91-9828671065.

GET ANSWER TO THIS QUESTION

100% UNIQUE SOLUTION WITHIN FEW HOURS


GET ANSWER

Related Questions