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
Travka [436]
4 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]4 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
Name two purposes of creating a microsoft account for use in visual studio 2015
Kazeer [188]
Creating a Microsoft account for use in Visual Studio 2015 means that you will get a better and optimized user experience, with several benefits.
Some of the purposes why you should create an account are:
1. free software, training and support from Visual Studio and broad range of benefits
2. synchronized Visual Studio Settings, which means that you will have for example the same layout, window and color theme, or whatever you select in the settings, every time you log in with your account


4 0
3 years ago
In many DBMSs where no strict separation of levels is maintained, this one language is used by the DBA and database designers to
marissa [1.9K]

Answer: False

Explanation:

This means that the mappings between the two schemas may be specified in either one of these languages.In most relational DBMSs today, there is no specific language that performs the role of SDL. Instead, the internal schema is specified by a combination of functions, parameters, and specifications related to storage. These permit the DBA staff to control indexing choices and mapping of data to storage

5 0
3 years ago
/*
Lera25 [3.4K]

Answer:

The answer to this question can be given as:

Method:

public static void showTwos(int number)  //method definition.

{

method body.  

System.out.print(number + " = ");  //print number

while (number % 2 == 0)   //condition

{

System.out.print("2 * ");    //print message.

number = number / 2;

}

System.out.println(number);    //print value.

}

Explanation:

In the above method definition firstly, we declare the method showTwos() that name is already given in the question then we pass a variable number as a parameter in the method. In this first, we take input number from the user and pass into this method. In this method we use a while loop it is an entry control loop in this loop first we modules the number if it is equal to 0.Then we divide the number by 2 and in the last, we print the value.

4 0
3 years ago
How the full address space of a processor is partitioned and how each partition is used?
Sati [7]

Answer:

?

Explanation:

?

6 0
4 years ago
The data below represents the yearly earnings (in $1000s of dollars) that high school and college (BS) graduates earn at a small
Taya2010 [7]

Answer:

library(moments)

library(readxl)

Exam1Q1 <- read_excel("Exam1Q1.xlsx")

View(Exam1Q1)

## Warning in system2("/usr/bin/otool", c("-L", shQuote(DSO)), stdout = TRUE):

## running command ''/usr/bin/otool' -L '/Library/Frameworks/R.framework/

## Resources/modules/R_de.so'' had status 1

plot(density(Exam1Q1$Highschool))

gostino.test(Exam1Q1$Highschool)

##  

##  D'Agostino skewness test

##  

## data:  Exam1Q1$Highschool

## skew = -0.24041, z = -0.69269, p-value = 0.4885

## alternative hypothesis: data have a skewness

agostino.test(Exam1Q1$BS)

##  

##  D'Agostino skewness test

##  

## data:  Exam1Q1$BS

## skew = 0.53467, z = 1.49330, p-value = 0.1354

## alternative hypothesis: data have a skewness

anscombe.test(Exam1Q1$Highschool)

##  

##  Anscombe-Glynn kurtosis test

##  

## data:  Exam1Q1$Highschool

## kurt = 2.56950, z = -0.29677, p-value = 0.7666

## alternative hypothesis: kurtosis is not equal to 3

anscombe.test(Exam1Q1$BS)

##  

##  Anscombe-Glynn kurtosis test

##  

## data:  Exam1Q1$BS

## kurt = 3.6449, z = 1.2599, p-value = 0.2077

## alternative hypothesis: kurtosis is not equal to 3

t.test(Exam1Q1$Highschool,Exam1Q1$BS, var.equal = T)

##  

##  Two Sample t-test

##  

## data:  Exam1Q1$Highschool and Exam1Q1$BS

## t = 0.16929, df = 76, p-value = 0.866

## alternative hypothesis: true difference in means is not equal to 0

## 95 percent confidence interval:

##  -1.131669  1.341926

## sample estimates:

## mean of x mean of y  

##  39.51282  39.40769

Explanation:

Summary:

The data set include two dependent variables which states High School annual earnings and BS annual earnings in the same small firm. Firstly, I used density plot function to view the distribution of two sets of variables. Secondly, I tested the skewness and kurtosis.Skewness of High School is -0.24041 which is left tail. Skewness of BS is 0.53476 which is right tail.Kurtosis of High School is 2.5695 which lower than 3 is platykurtic. Kurtosis of BS is 3.6449 which larger than 3 is leptokurtic. Thirdly, the sample population is 39 for each and has unknow standard deviation, so that I’m going to use t-test to perform the comparing analysis. The result shows p-value which equal to 0.866 is larger than significant value(alpha = 0.05). To the concludsion, there is no difference between yearly earnings of High School and of BS at a small firm.

3 0
3 years ago
Other questions:
  • Because you do not know every possible future use for the data TerramEarth collects, you have decided to build a system that cap
    15·1 answer
  • Which layer of the osi model defines functions related to data delivery, error recovery, and flow control?
    8·1 answer
  • 1. Which sign-in method requires users to press Ctrl+Alt+Delete before signing in?
    5·1 answer
  • To achieve balance—that is, to operate an information system that satisfies the user and the security professional—the security
    13·1 answer
  • Dynamic alliance networks work best in industries: a. that are mature and stable in nature. b. where the coordination of product
    9·1 answer
  • Consider the following program segment: //include statement(s) //using namespace statement int main() { //variable declaration /
    9·1 answer
  • People of brainly Just a quick warning that there is a group of people posting links with virus.
    11·2 answers
  • A(n) ___________________ is a set of characters that the originator of the data uses to encrypt the text and the recipient of th
    10·1 answer
  • What product use programmable control?
    11·1 answer
  • Write an expression in Boolean algebra that evaluates to 1 when an odd number of bits of the number is 1 and 0 otherwise
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!