answer.
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
Travka [436]
2 years ago
3

Create a subclass of Bird called Sparrow. Overwrite the eat() method so that the Sparrow eats "seeds". Implement the fly() metho

d so that it returns its altitude of 4.13 meters.
Computers and Technology
1 answer:
gregori [183]2 years ago
6 0

Answer:

<em>public class Sparrow extends Bird {</em>

<em>    private double flyheight;</em>

<em>    public Sparrow(String name, double flyheight) {</em>

<em>        super(name);</em>

<em>        this.flyheight = flyheight;</em>

<em>    }</em>

<em>    public Sparrow(String name) {</em>

<em>        super(name);</em>

<em>    }</em>

<em>    public Sparrow(String name, String foodName) {</em>

<em>        super(name, foodName);</em>

<em>    }</em>

<em>    @Override</em>

<em>    public void eat(String food) {</em>

<em>        super.eat(food);</em>

<em>    }</em>

<em>    public double fly(double altitude){</em>

<em>        return this.flyheight;</em>

<em> }</em>

<em>      public double getHeight() {</em>

<em>     return flyheight;</em>

<em>}</em>

<em>    public void setHeight(double height) {</em>

<em>        this.flyheight = height;</em>

<em>    }</em>

<em>}</em>

Explanation:

THE PARENT CLASS BIRD IS GIVEN BELOW:

<em>public class Bird {</em>

<em>    private String name;</em>

<em>    private String foodName;</em>

<em>    public Bird(String name, String foodName) {</em>

<em>        this.name = name;</em>

<em>        this.foodName = foodName;</em>

<em>    }</em>

<em>    public Bird(String name) {</em>

<em>        this.name = name;</em>

<em>    }</em>

<em>    public void eat(String food){</em>

<em>        System.out.println("Eating "+food);</em>

<em>    }</em>

<em>    public String getName() {</em>

<em>        return name;</em>

<em>    }</em>

<em>    public void setName(String name) {</em>

<em>        this.name = name;</em>

<em>    }</em>

<em>}</em>

THE TEST CLASS  IS GIVEN BELOW:

<em>public class TestClass {</em>

<em>    public static void main(String[] args) {</em>

<em>        Sparrow sparrow = new Sparrow("sparrow1",4.13);</em>

<em>        sparrow.eat("seed");</em>

<em>        System.out.println("The Sparrow is flying at: "+sparrow.fly(4.13));</em>

<em>    }</em>

<em>}</em>

You might be interested in
If you’d like to have multiple italicized words in your document, how would you change the font of each of these words?
Mariana [72]
You select the words and then format - italics
5 0
2 years ago
Read 2 more answers
What is the impact of VR on Educational Learning rather than games?​
nekit [7.7K]

Answer : Candice

Explanation: Candice penis fit in your mouth

3 0
2 years ago
Which of the following is an advantage of inserting a page number field in your document rather than inserting each page number
Artyom0805 [142]

The advantage of inserting the page number field is that the page number field could show the current page number.

The following information should be relevant with respect to the page number:

  • The page number field & the actual page number should be formatted.
  • The page number field & the actual page number both could be inserted into the header or footer.
  • The page number field & the actual page number could be easily inserted into the document.

Therefore we can conclude that the advantage of inserting the page number field is that the page number field could show the current page number.

Learn more about the page number here: brainly.com/question/3063419

8 0
2 years ago
A network technician sets up an internal dns server for his local network. When he types in a url which is checked first
VLD [36.1K]

Answer:

The first thing that the browser checks is the cache for the DNS record to find the corresponding IP address.

Explanation:

After the technician sets up the internal DNS server for his local network, the first thing that is checked when he types a website into the url of a browser is the cache to look for corresponding IP addresses.

DNS which means Domain Name System is a database that maintains the website name (URL) and the IP address that it is linked to. There is a unique IP address for every URL (universal resource locator).

Internal DNS servers store names and IP addresses for internal or private servers

8 0
2 years ago
Put the steps in order to produce the output shown below. Assume the indenting will be correct in the program.
V125BC [204]

Answer:

I took a screenshot of the test withe that question

Explanation:

7 0
2 years ago
Other questions:
  • Represent decimal number 8620 in (a) BCD, (b) excess-3 code, (c)2421 code, and (d) as a binary number
    7·1 answer
  • A(n) _____ is the highest educational degree available at a community college. master bachelor associate specialist
    13·2 answers
  • What tool extends the basic functionality provided in task manager with additional features and tools?
    8·1 answer
  • Elias wants to name his data in an excel file. Which step is incorrect?
    13·1 answer
  • Consider an application that transmits data at a steady rate (for example, the sender generates an N-bit unit of data every k ti
    8·1 answer
  • Does the Boolean expression count &gt; 0 and total / count &gt; 0 contain a potential error? If so, what is it?
    8·1 answer
  • Given numRows and numColumns, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print
    14·1 answer
  • Will mark brainliest if correct. First come, first serve.
    15·1 answer
  • A few of your employees have complained that their computers sometimes shut down spontaneously. You have noticed that these empl
    6·1 answer
  • Consider the method total below: public static int total (int result, int a, int b) {     if (a == 0)    {      if (b == 0)     
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!