Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code using Python 3 see pic and answer TODO in red. class Car: det init (self,x): if len(x) 13: raise Exception(NOT CREATED CORRECTLY self.mpgexte) self.tank

code using Python 3
see pic and answer "TODO" in red.
image text in transcribed
image text in transcribed
class Car: det init (self,x): if len(x) 13: raise Exception("NOT CREATED CORRECTLY self.mpgexte) self.tank Capacity (1) self.curras [2 dot travelMilesiselt, siles): If possist > currentfuel/capacity exler Car (30)7/18 gallons main ass Cainit 3: class Car: def __init__(self, *x): if len(x) !=3: raise Exception("NOT CREATED CORRECTLY") self.mpg=x[0] self.tank Capacity = x[1] self.currGas = [2] def travelMiles(self, miles): possDist = self.mpg*self.currGas if possDist =0 # TODO: Add in refuel car function, that fills the tank to capacity def __str__(self): return "Car (0) 0/1) gallons".format(self.mpg, self.currGas, self.tank Capacity) def main(): pass # TODO ADD CODE HERE # Ask the user for the tank size of their car and its mpg rating, #create an instance of that car and make sure the tank is full #(DO NOT USE REFUEL FUNCTION, initialize as full) # Travel 5 miles # Print out the car in the format: Car () current fuel/capacity #example: "Car (30) 7/18 gallons" # Refuel Tank # Travel 1000 miles # Print out the car in the format: #Car () current fuel/capacity #example: "Car (30) 7/18 gallons if -_name__-..._main__": main()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions

Question

1. 3.7% 11. 2.45\% 111.2.35% IV. 0.7 V. 5.65%

Answered: 1 week ago