python

 

Problem 1: Car Class

  1. Write a class named Car that has the following data attributes:
    • __year_model (for the car’s year model)
    • __make (for the make of the car)
    • __speed (for the car’s current speed)
    • The Car class should have an __init__ method that accepts the car’s year model and make as arguments. These values should be assigned to the object’s __year_model and __make data attributes. It should also assign 0 to the __speed data attribute.
      The class should also have the following methods:
    • accelerate
      The accelerate method should add 5 to the speed data attribute each time it is called.
    • brake
      The brake method should subtract 5 from the speed data attribute each time it is called.
    • get_speed
      The get_speed method should return the current speed.
    • Next, design a program that creates a Car object and then calls the accelerate method five times. After each call to the accelerate method, get the current speed of the car and display it. Then call the brakemethod five times. After each call to the brake method, get the current speed of the car and display it.

Problem 2: Personal Information Class

  1. Design a class that holds the following personal data: name, address, age, and phone number. Write appropriate accessor and mutator methods. Also, write a program that creates three instances of the class. One instance should hold your information, and the other two should hold your friends’ or family members’ information.

Needs help with similar assignment?

We are available 24x7 to deliver the best services and assignment ready within 3-4 hours? Order a custom-written, plagiarism-free paper

Get Answer Over WhatsApp Order Paper Now