Nov-04-2017, 04:18 AM
Okay, the first part of my assignment was to make a Class called Car. I have done this with the data attributes and methods they told me to use:
Can someone help me with this last half of the assignment I need to do or at least help me start out? I'd really appreciate it.
class Car(): def __init__(self, year_model, make): self.__year_model = year_model self.__make = make self.__speed = 0 def accelerate(self): self.__speed += 5 def brake(): if self.__speed >=5 self.__speed -= 5 else: print 'Error, you are not moving' def get_speed(): return self.__speedI did this the day of my class, when everything was fresh in my mind. I still have to make an accompanying program with this for the assignment that creates a Car object then calls the accelerate method five times and display the new car speed after each accelerate method then do the same with the brake method. However, my mind is so foggy now that I can't remember how to do it.
Can someone help me with this last half of the assignment I need to do or at least help me start out? I'd really appreciate it.