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
shusha [124]
3 years ago
8

Create a class called Toddler that inherits from a class called Parent. (Note that Parent has already been defined elsewhere, so

you should not redefine it here.) Toddler should provide one constructor that takes the toddler’s age as an int argument. It should also call the superclass constructor with the age as the first argument and the String "toddler" as the second argument.
Computers and Technology
2 answers:
tester [92]3 years ago
8 0

Answer:

The solution code is written in Java:

  1. public class Toddler extends Parent {
  2.    private int age;
  3.    public Toddler(int age){
  4.        this.age = age;
  5.        super(age, "toddler");
  6.    }
  7. }

Explanation:

Firstly, we create a class named Toddler. To inherit the class from Parent, we can use the extends keyword (Line 1). We also presume the Parent class has been defined in advanced.

Next, we declare a private scope attribute which is age in Toddler class (Line 3).

Create a constructor that take age as input parameter (Line 5).

Assign the input age to the private attribute age (Line 6).

Next, we use super keyword to call the superclass constructor by passing age and string "toddler" as arguments (Line 7).

NemiM [27]3 years ago
5 0
<h2>Answer:</h2>

//Create the Toddler class

//to inherit from the Parent class  by

//using the "extends" keyword

public class Toddler extends Parent{

   //Create an instance variable to hold the toddler's age

   int age;    

   //Create a constructor for the Toddler class

   //to take the toddler's age as argument

   Toddler (int age){

       

       //Initialize the instance variable age

       this.age = age;

       //Call the parent constructor using "super"

       //and pass in the toddler's age and the string "toddler"

       //as arguments

       super(age, "toddler");

   }  // End of constructor

}   //End of class declaration

=========================================================

<h2>Explanation:</h2>

The program above has been written in Java and it contains comments explaining every line of the code. Please go through the comments carefully.

The actual lines of code have been written in bold-face to distinguish them from comments.

You might be interested in
Def find_max(nums: [int]) -&gt; int:
SIZIF [17.4K]

Answer:

The program in recursion is:

def find_max(nums):

    if len(nums) == 0:

         return "None"

    elif len(nums) == 1:

         return nums[0]

    else:

         return max(nums[0],find_max(nums[1:]))

Explanation:

This line defines the function

def find_max(nums):

This checks if the list is empty.

    if len(nums) == 0:

If yes, it returns "None"

         return "None"

If the list has just one element

    elif len(nums) == 1:

It returns the only element as the maximum

         return nums[0]

If the list has numerous elemente

    else:

The maximum is determined recursively

         return max(nums[0],find_max(nums[1:]))

To the (b) part:

<em>This program does not necessarily need to be done recursively because the max built-in function can be used to determine the maximum of the list in just one line of code and it is more efficient.</em>

8 0
3 years ago
Why is brainly so addictinggggggggg!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Lady_Fox [76]

Answer:

ok but give me brainliest also plz

Explanation:

5 0
3 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
Can someone help me with these questions on linear dimensions pls
andrew-mc [135]
Size dimentions reffer to overall dimentions and will tell the overall width, lenth height and depth of something location dimentions means the locatuon of each geometric shape.
7 0
3 years ago
Read 2 more answers
You type. The word "weather" when you ment "whether" when will the writer or word flag this as a misspelling or a grammar proble
xxTIMURxx [149]
Most likely depends on the situation
8 0
3 years ago
Other questions:
  • Microsoft ____ is the new web browser.
    13·2 answers
  • Write about the future of Reliability and Security in Software Engineering.
    13·1 answer
  • Need 9&amp;10. Thank you! Btw it's due today.
    11·1 answer
  • Please I need help!!!!!!!
    14·2 answers
  • Can anyone help me<br> I will make you a brainalist
    13·1 answer
  • Want to network 2 laptops togetger using ethernet cable...But it won't connect
    9·1 answer
  • In a database, it is possible to make changes such as font, text style, text color, line color, and background color. true false
    13·2 answers
  • What is the function of a breadcrumb trail in a website?
    13·1 answer
  • A. Fill in the blanks:
    6·1 answer
  • Globalization is based on <br>​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!