Write Class Named Car Following Data Attributes Yearmodel Car S Year Model Make Make Car S Q37070256

Write a class named Car that has the following dataattributes:

  • __year_model: (for the car’s year model)
  • __make: (for the make of the car)
  • __speed: (for the car’s current speed)

In addition, the class should have the following methods:

  • __init__ method that accepts the car’s year model and make asarguments.
    These values should be assigned to the object’s __year_model and__make
    data attributes. It should also assign 0 to the __speed dataattribute.
  • accelerate: The accelerate method should add 5 to the speeddata attribute when
    it is called.
  • brake: The brake method should subtract 5 from the speed dataattribute each
    time it is called.
  • get_speed: The get_speed method should return the current speed
    • Next, design a
      OR
      OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.