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
A Molex Connector that connects into a DVD player is easily identifiable by its
Usimov [2.4K]
By its 4 pin socket. ;) Hope this helps!
3 0
3 years ago
Read 2 more answers
A Windows computer is experiencing a problem accessing the Internet. The network patch cable and network interface card have bee
Svet_ta [14]

Answer:

The next step to consider is updating the system's network settings

Explanation:

The next step after testing and verifying that the network patch cable and network interface card are working is to update the network settings to recent configurations.

Updating the system's network include settings of network adapter, LAN / Wi-Fi and TCP/IP.

Looking into your network settings is one of steps of effectively troubleshooting a system's network.

Few settings you could update are

1. LAN settings

2. TCP/IP network protocol properties

3. Network adapter settings

4. Internet connection

Effectively, updating the network settings is the next step. Few things to take note of when updating the network settings are

1. Create Standard Configurations for Device Classifications

2. Maintain the Current and Previous Network Configurations

3. Keep Track of Changes

4. Lastly, Document Network Changes

8 0
4 years ago
Write a recursive method that takes four inputs: a 1-D array of Strings (i.e., exams), the length of this 1-D array (i.e., n), a
ale4655 [162]

Answer:

import java.util.*;

public class Main

{

       public static void main(String[] args)  

       {

           String [] exams = {"1;2;3;4;" , "5;6;7;8;" , "9;10;11;12;" };

           double[][] n = new double[exams.length][4];

           examArray = convert(exams , exams.length , 0 , n);

           for(int i = 0 ; i < exams.length ; i++)

           {

               for(int j = 0 ; j < 4 ; j++)

               {

                   System.out.print(n[i][j] + "\t");

               }

              System.out.print("\n");

           }

       }    

       

/* recursive function convert defined here */

       public static double[][] convert(String[] exams , int number , int x , double [][] result)

       {

           if(x==number)

               return result;

           else

           {

               String total = exams[x];  

               String currentScore = "";

               int p = 0;

               for(int j = 0 ; j<totalScore.length() ; j++)

               {

                   char ch = total.charAt(j);/

                   if(ch==';')

                   {

                       result[x][p] = Double.parseDouble(currentScore);

                       p++;

                       currentScore = "";

                   }

                   else

                   {

                       currentScore = currentScore + Character.toString(ch);

                   }

               }

               return convert(exams , number , x+1 , result);

           }

           

       }

}

Explanation:

The Java source code defines a recursive function or method called convert that converts the results of three students that sat for four examinations to double or float number and screens their individual results for the four exams on the screen.

5 0
3 years ago
A drawback of using observation as a data collection method is that:_______
melamori03 [73]

Answer:

The answer is d, because it is not reliable in the sense that it can be used for important and sensitive information when your collecting data.

8 0
4 years ago
Is a component that provides a button control in a gui application or applet?
harina [27]
<span>GUI is a graphical user interface. It is a graphical window that provides interaction with the user. 
</span>The button is a pushbutton, which can be pressed to trigger an action.<span>
A graphic control component or a control element is a component that provides a button control in a GUI application. It is also called a control element because it </span><span>is an element of interaction between the user controlling the application.</span>
7 0
4 years ago
Other questions:
  • Torque is defined as _____.
    7·1 answer
  • Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have alre
    8·2 answers
  • In Word, tables can be styled much like text can.<br> True<br> False
    6·1 answer
  • ​according to your text, digital natives tend to prefer different digital communication channels more than do digital immigrants
    5·1 answer
  • How can you tell if a motherboard can be watercooled?
    13·1 answer
  • May someone help please. :(
    9·1 answer
  • We all had the unfortunate experience of seeing how computers can, at times, make life's journey about more difficult. This is e
    13·1 answer
  • Which of these purchases is most likely to be paid for with a credit card
    13·1 answer
  • Verbs in the active and passive voice
    14·1 answer
  • Deleting messages keeps them in the mailbox and on the server. How can they be removed from the server to reduce the quota?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!