04. Need for Speed - Inheritance Exercise - Python OOP
Здравейте, колеги имам следния въпрос: Как по-точно става да промениш DEFAULT_FUEL_CONSUMPTION когато "parent" e по различен от "child" ? Защото ми излиза винаги нещо, като например unexpected attribute или подобни неща. Благодаря ви предварително!
Това са условията на задачата:
Create the following hierarchy with the following classes:
and submit in judge a zip file, containing a separate file for each of the classes using the structure shown below:
Create a base class Vehicle. It should contain the following attributes:
⦁ DEFAULT_FUEL_CONSUMPTION – float (constant)
⦁ fuel_consumption – float
⦁ fuel – float
⦁ horse_power – int
⦁ A public constructor which accepts (fuel, horse_power) and set the default fuel consumption on the attribute fuel_consumption
The class should have the following methods:
⦁ drive(kilometers)
⦁ The drive method should have a functionality to reduce the fuel based on the travelled kilometers and fuel consumption. Keep in mind that you can drive the vehicle only if you have enough fuel to finish the driving.
The default fuel consumption for Vehicle is 1.25. Some of the classes have different default fuel consumption:
⦁ SportCar – DEFAULT_FUEL_CONSUMPTION = 10
⦁ RaceMotorcycle – DEFAULT_FUEL_CONSUMPTION = 8
⦁ Car – DEFAULT_FUEL_CONSUMPTION = 3
Remember, there's no shame in seeking help when you need it. It's better to reach out for assistance than to struggle and risk getting a poor grade. So, don't hesitate to take advantage of the resources available to you and get the help you need to succeed. I can recommend you a college essay writing service I trust. I know how difficult it is to find a reliable company that will write well and won’t charge a huge price for it. I’m sure that BestCustomWriting.com is the one you’re searching for.