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
Henry is having a problem with the electrical system on his current laptop. The battery for the laptop will not charge. Henry to
Juliette [100K]

Answer:

There is a short circuit in a component in the power circuit.

Explanation:

The power circuit in a computer system, regulates, rectifies and steps down power and voltage entering the main motherboard.

When a power surge capable of damaging the motherboard occurs, A component in the power circuit is shorted, not allowing the dangerous power to pass.

This can be troubleshooted by passing a high current, since the shorted component has a high emf. It over heats and is detected and changed.

4 0
4 years ago
In order to generate a random number, you must use Math.random( ). Group of answer choices True False
Tanzania [10]

Answer:

False

Explanation:

While Math.random() can be used to generate a random number, Java programming language also has a class called Random in the java.util package which can be imported into your code. This is a more efficient way of generating random numbers (ints or doubles) as you can instantiate several random number generators. The following line of code creates an an object of the class Random and sets the bound to 10.

Random rand = new Random (10);

This will generate random number from 0-9.

5 0
4 years ago
Which question is MOST important for an office to consider when upgrading to new software
Marina CMI [18]
Either B or D those are the most reasonable answers if it were up to me to answer i would pick B but that is up to you go ahead and try your best i hope u have a nice day ✨✌️✨
6 0
3 years ago
IBM’s system that is built on the middle ground approach to AI.
Norma-Jean [14]

Answer:

IBM Watson is AI for business. Watson helps organizations predict future outcomes, automate complex processes, and optimize employees' time.

Explanation:

6 0
3 years ago
An increase in Consumption will ___________ in the Classical Model of Aggregate Demand.
Step2247 [10]
The answer to your question is b
8 0
3 years ago
Other questions:
  • Marie can now edit her photos, send them in emails, print them on a printer, and use them as wallpaper on her computer. This is
    9·2 answers
  • Tags that provide browsers with information about document characteristics
    15·1 answer
  • Caroline has been asked to find a standard to guide her company’s choices in implementing information security management system
    13·1 answer
  • An expression using the logical operator ____ will evaluate to true when either of the compound conditions is true.
    6·1 answer
  • Fractures in Earth’s crust where displacement has occurred are called
    13·1 answer
  • 1.2 Data transmission speed.Unit of measurement used to measure in bits per second.1000 bits per second (bps)=
    11·1 answer
  • The _________ indicates the number of elements, or values, an array can hold
    14·1 answer
  • Tel me free english learning website?
    5·1 answer
  • In order for storage devices to be prepared for use, they must be ____________ Group of answer choices pre-prepared loaded initi
    11·2 answers
  • Taran wants to work in the technology field but is unsure of which career to pursue. He has been told he has strong people skill
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!