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
What is the computer?​
DiKsa [7]

Answer:

an electronic machine that can store, find and

8 0
2 years ago
Patient letters created from __________ use structured data and do not require a large amount of typing from the medical assista
umka2103 [35]
Templates I think. not sure
3 0
2 years ago
Which of the following is the correct order of laws (from local to state to federal)
professor190 [17]

Answer:

That, Federal law > Constitutional Law > State law > Local ordinances

Explanation:

4 0
3 years ago
A videogame designer would be most interested in the _____ elements of beowulf.
adelina 88 [10]
I think he would be interested in a. epic elements of beowulf.
5 0
3 years ago
Read 2 more answers
Question 2 of 10
horrorfan [7]

Answer:

Lowest Level; Machine Language.

Explanation:

The lowest level of a computer is machine language, which are strings of 0's and 1's in bits, and it's possible to perform tasks at this level. It's however difficult to do and humans created <em>Assembly</em>; a type of low level programming language to be readable, and converts to machine language so that we don't have to work in binary.

4 0
2 years ago
Other questions:
  • 3. Discuss the disadvantages of file-based systems.
    13·1 answer
  • You’ve received a tarball called data79.tar from a colleague, but you want to check the names of the files it contains before ex
    15·1 answer
  • Differentiate between third and fourth generation of computer​
    6·1 answer
  • 2. Statement: "I don't agree with you." Nonverbal gesture: Type of gesture:
    6·1 answer
  • Which f the following is not a characteristic of igneous rock
    8·1 answer
  • If you press the key corresponding to letter A on the keyboard, what process is carried out inside the CPU to display the letter
    10·1 answer
  • Write a C++ program in which you declare variables that will hold an hourly wage, a number of hours worked, and a withholding pe
    12·1 answer
  • PLEASEEE HELPPP
    7·1 answer
  • Choose all that apply.
    5·2 answers
  • Kaitlin likes a particular design theme, but she is not sure about every single color for bullets, backgrounds, etc. found in th
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!