1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
saw5 [17]
4 years ago
8

Write a class named Car that has the following data attributes: __year_model: (for the car's year model) __make: (for the make o

f 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 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. accelerate: The accelerate method should add 5 to the speed data attribute when it is called. brake: The brake method should subtract 5 from the speed data attribute eachtime it is called. get_speed: The get_speed method should return the current speed
Computers and Technology
1 answer:
rewona [7]4 years ago
7 0

Answer: Provided in the explanation section

Explanation:

Provided below is the program to carry out this task, i hope you can follow it clearly.

Program is run below

class Car:

   def __init__(self, model, make):

       self.__year_model = model

       self.__make = make

       self.__speed = 0

   def accelerate(self):

       self.__speed += 5

   def brake(self):

       self.__speed -= 5

   def get_speed(self):

       return self.__speed

car = Car("F1", "Ferrari")

for i in range(5):

   car.accelerate()

   print(car.get_speed())

for i in range(5):

   car.brake()

   print(car.get_speed())

cheers i hope this helped !!

You might be interested in
Internet Security: How can you work securely on the internet? What actions should be avoided and what are the pitfalls?
Cerrena [4.2K]

Answer:First of all, to work safely at the internet you should avoid any not secure page, and if you can’t do that, avoid entering stuff such as credit cards or passwords on this sites. Now, to work safely it’s recomendable to have a VPN(virtual private network), that hides your IP direction.

Explanation:

8 0
3 years ago
Does virtualization impact the design of programs on behalf of the process/threading model?
zaharov [31]

Answer:

 Virtualization is the process which refers to the isolating the various computing resources that basically run without depend on the particular platform in the environment.

The virtualization basically allow the various application like software and hardware that mainly used to connect different types of server and storage applications.

The virtualization impact while designing the program is that it helps in the program execution process and also reducing the impact by using the hardware virtualization support in the system. The thread system also maintain the virtualization impact while designing.

7 0
4 years ago
To change the overall design of an entire document to include colors, fonts, and effects, a user should apply a _____.
Olenka [21]
User should apply a theme.

Hope this helps!
8 0
3 years ago
Read 2 more answers
Higher-speed Ethernet technologies use an electronic device known as a Hub rather than a switch True/False
Ivenika [448]
This should be false
4 0
3 years ago
The illustrations group contains all but a _______​
antiseptic1488 [7]

Answer:

Shapes button

Chart button

Photo button

Pictures button

Explanation:

In Microsoft Word, the illustration group has all the following options apart from the photo button. It can be found in the Insert tab of the Word document. The illustrations group is where you make several adjustments to your Word document by inserting online and offline pictures and clip art, shapes, charts, and screen shots.

6 0
3 years ago
Other questions:
  • 11.19 LAB: Max magnitude Write a function max_magnitude() with two integer input parameters that returns the largest magnitude v
    7·1 answer
  • write a simple assembly code using 8088 microprocessor instruction set to add two numbers ? please help me if you know :(​
    11·1 answer
  • A colleague asks you to research a CPU for a new server that will run Windows Server 2019. He explains the server roles that he
    7·1 answer
  • Declare an array named tax rates of five elements of type double and initialize the elements (starting with the first) to the va
    12·1 answer
  • when you type a day, month, or date, what features does Word use to automatically complete typing the day, month, or date for yo
    6·1 answer
  • Which command is used to copy entire folder structures between volumes or across a network while maintaining all NTFS file permi
    10·1 answer
  • Pleasee telllllllllllllllllll​
    15·1 answer
  • What is a function in Microsoft Excel?
    5·1 answer
  • Why do I keep getting points if I haven't answered anything? I don't want points.
    12·1 answer
  • Part of the operating system core is responsible for controlling security, managing the file system, and providing a platform fo
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!