Problem 1: Car Class
Need Help Writing an Essay?
Tell us about your assignment and we will find the best writer for your paper.Write My Essay For Me
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:
The accelerate method should add 5 to the speed data attribute each time it is called.
The brake method should subtract 5 from the speed data attribute each time it is called.
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
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.
The post python appeared first on Course Help Online.
Custom academic and business writing services. You made my dreams come true! I got better results than any other student for a very complex capstone project! Your company is very helpful. Thanks! Would you like to make your academic life easier? We offers you a perfect chance to buy essays online and let our writers take care of your academic achievements! Each paper is composed from scratch, according to your instructions