Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a python program Write a python program Write a python program Write a pyt

ID: 3772150 • Letter: W

Question

Write a python program Write a python program
Write a python program
Write a python program
Create a class Vehicle. It should have noofwheels It's constructor must take in three parameters It should also have a function called calculate Toll) that returns the toll to be paid by that car. The toll (integer), maxspeed (float), and color (string) as instance variables , an integer, a float and a string, and set the instance variables to those values. is 15 the number of wheels It should also have a tunction called caiculate Toil Finally create functions getnoofwheels0, get respectively that returns the toll o be paid by that car. The toll is 15 the number of wheels. maxspeed0, and getcolorO that return the noofwheels, maxspeed, and color

Explanation / Answer

Answered questions 1,2 and 3


class Vehicle:
    def __init__(self, noOfWheels,maxspeed, color):
        self._noOfWheels = noOfWheels
        self._maxspeed = maxspeed
        self._color = color
   
    def calculateToll(self):
        return 15 * self._noOfWheels
   
    def getnoOfWheels(self):
        return self._noOfWheels
   
    def getmaxspeed(self):
        return self._maxspeed
   
    def getcolor(self):
        return self._color
   
   
class Bike(Vehicle):
    def __init__(self, maxspeed, color):
        super().__init__(2, maxspeed, color)
   
    def doWheelle():
        print("Wheeeeeeeee!");
   

blue = Bike(100, "BLUE")
print("Bike: No of wheels: ",blue.getnoOfWheels(), "   Max speed: ", blue.getmaxspeed(), " Color: ",blue.getcolor())
red = Vehicle(4,120, "RED")
print("Vehicle: No of wheels: ",red.getnoOfWheels(), "   Max speed: ", red.getmaxspeed(), " Color: ",red.getcolor())

--output--

Bike: No of wheels: 2    Max speed: 100 Color: BLUE
Vehicle: No of wheels: 4    Max speed: 120 Color: RED

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote