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
Veseljchak [2.6K]
3 years ago
13

Create a derived class called Car that inherits from Vehicle. The constructor should call the base class constructor, with 4 for

doorcount and "rrrrrr" for engine sound. The Car class should override the Move() method to return "vrumm". The Car should implement a method called RoadTrip(), which should return "Not a care in the world
Computers and Technology
1 answer:
Vitek1552 [10]3 years ago
3 0

Answer:

Hi there Foodalexandre! The question is good to revise knowledge on the concepts of classes and inheritance. Please find the answer with explanation below.

Explanation:

We can use a number of different object-oriented programming languages to implement this solution in, such as Java, C++, Ruby, etc. I have chosen to use Python as the language to implement because of the ease with which it can be used. First, I have defined the Vehicle class based on the description from the question, where the constructor (the __init__ method) initializes the door count and the engine sound, and the original Move() method belonging to the Vehicle class is defined. Then I define the Car class which inherits from the Vehicle class making it inherit the Vehicle properties, and initialize the Car class to have door count of 4 and engine sound as 'rrrrrr'. Defining the Move() method again in the Car class overrides the one in the Vehicle class, and the RoadTrip() method is added to return the string as requested in the question.  

class Vehicle(object):  

 def __init__(self, door_count, engine_sound):    

   door_count: door_count      

   engine_sound: engine_sound    

 def Move() :

   return ‘rrrrrr’  

class Car(Vehicle):  

 def __init__(self, door_count, engine_sound):    

   super().__init__(4, ‘rrrrrr’)  

 def Move():    

   return ‘vrumm’    

 def RoadTrip() :    

   return “Not a care in the world”

You might be interested in
Which theorist studied the power elite and the influence they had over society?
Pavel [41]
The correct answer is <span>C. Wright Mills
He was a rather famous sociologist from the 20th century who also worked as a professor at Columbia university. He was a leftist and one of his famous books "The Power Elite" was crucial in describing class relations in the US between the elites and the regular people.</span>
6 0
3 years ago
What term refers to the text label that describes each data series?
lbvjy [14]
Field is the term that refers to the text label that describes each data series
7 0
3 years ago
azure claims there are 54 regions. but when i create my account, i can only see 30 or so. what happened to the other regions?
stira [4]

Explanation:

Some regions may not have the full suite for the utilization of the Microsoft Azure platform or they may possess limited capabilities for them to fully function.

6 0
3 years ago
Functions<br> of beaker​
pishuonlain [190]

Answer:

Beaker Purpose

Although the purpose of a beaker is to contain and measure liquids, the glassware can come in a multitude of shapes and sizes. Most often, a beaker is cylindrical in shape and has a flat bottom. Some beakers have a small beak or spout to aid in the pouring of liquids.

Here hope that helps know mark me as brill

3 0
3 years ago
Microsoft Publisher - Assignment #1
Allisa [31]

Answer:1

Explanation:

6 0
3 years ago
Other questions:
  • Pat creates a table in a spread sheet
    9·1 answer
  • You have a large company, and it is important to your business that your employees' work is backed up regularly. Which network w
    5·1 answer
  • Given that k refers to an int that is non-negative and that plist1 has been defined to be a list with at least k 1 elements, wri
    14·1 answer
  • The CPU package is installed using the ____ process
    7·1 answer
  • Explain what it means to have good file management skills.
    10·1 answer
  • Your company has purchased another company that also uses Windows Server 2016 and Active Directory. Both companies need to be ab
    11·1 answer
  • A _______ read inputs the first data item from a file. It typically appears immediately before the loop that processes the data
    5·1 answer
  • 8. Why is it important not to download pictures to your school or workplace network if you do not plan to use them?
    10·1 answer
  • Madeleine's Instructor praised her for capturing a nearly perfect image. It included dominance, harmony, and proportion among ot
    13·1 answer
  • Pick the correct statements on the 64-bit machine representation of numbers.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!