Question
Build a program to manage a race car in this assessment. The code will consist of a for-loop method that will run a car around
Build a program to manage a race car in this assessment. The code will consist of a for-loop method that will run a car around a race track and cause "wear and tear" on the car. The car will perform x number of laps and will have to make pitstops when it either runs out of gas or needs a tire replacement. The for loop will be simple
def wear_tires(car):
tire -=1
def use_gas(car):
gas -=1
c = Car() # You need to make this part
for i in range(100):
if the car needs a pitstop:
perform pitstop
else:
wear_tires(c)
use_gas(c)
# Display the current cars wear in a much better format
- print(c.tire)
- print(c.gas)
- print("Current Lap is: " , i)
You must use this for loop and build out the two methods in the main Python program for this task. To use the above code, you must build two pieces of information.
- An abstract Vehicle class
- A Car class
- A RaceCar class
Each with its methods and variables. This programming will involve using inheritance and abstraction to make a race car that should be doing the race. Do not forget to add the comments.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
Principles Of Information Security
Authors: Michael E. Whitman, Herbert J. Mattord
7th Edition
035750643X, 978-0357506431
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App