5. Create a class named Bee. This class extends the Animal class (use the keyword extends...
Fantastic news! We've Found the answer you've been seeking!
Question:
![5. Create a class named Bee. This class extends the Animal class (use the keyword extends to do so) and](https://dsd5zvtm8ll6.cloudfront.net/questions/2023/12/65821938ebfc9_1703114917548.jpg)
Transcribed Image Text:
5. Create a class named Bee. This class extends the Animal class (use the keyword extends to do so) and extends the interface FlyingAnimal (use the keyword implements to do so). Open the editor and delete all the code placed in it automatically by BlueJ. a. wings: declare a new private attribute named wings. This attribute will store how many wings this animal has. b. Default constructor: Define a default constructor that takes no parameters. Have this constructor call the constructor of the superclass Animal (using the super keyword) to specify that all bees have 6 (six) legs. c. Parameterized constructor: Define a constructor that takes one int parameter named wingsNum which specifies the number of wings for a bee. This constructor must also call the superclass constructor (Animal) to specify that all bees have 6 legs. d. walk (): You do not have to re-implement this method for this class. Recall that this method is defined as a concrete method in class Animal, which means you can use the version implemented in the class Animal. e. eat(): This method is declared as an abstract method in the abstract class Animal therefore, any class extending Animal will have to implement this method. Provide your implementation for this method. This implementation should provide some description of what this animal eats. For example, in the case of class Bee, the eat () method can print out the following statement: Bee eats flower nectar. f. sound (): This method is declared as an abstract method in the abstract class Animal therefore, any class extending Animal will have to implement this method. Provide your implementation for this method. This implementation should provide some description of the sound this animal makes. For example, in the case of class Bee, the sound () method can print out the following statement: Bee sound is a zzz. Note: In the next steps you have to implement the FlyingAnimal interface methods for this class, since class Bee implements the FlyingAnimal interface. g. getWings (): is an abstract method defined in FlyingAnimal class. This method returns an int value of the private attribute wings and accepts no parameter. h. setWings (int wings): is an abstract method defined in FlyingAnimal class. This is a void method and accepts 1 parameter named wings to set the value of the private attribute wings. i. speed (): is an abstract method defined in FlyingAnimal class. Provide your implementation for this method, this method should print out the typical speed of this animal. For example, this method can print out the following statement: Bee speed is 6 miles/hour. 5. Create a class named Bee. This class extends the Animal class (use the keyword extends to do so) and extends the interface FlyingAnimal (use the keyword implements to do so). Open the editor and delete all the code placed in it automatically by BlueJ. a. wings: declare a new private attribute named wings. This attribute will store how many wings this animal has. b. Default constructor: Define a default constructor that takes no parameters. Have this constructor call the constructor of the superclass Animal (using the super keyword) to specify that all bees have 6 (six) legs. c. Parameterized constructor: Define a constructor that takes one int parameter named wingsNum which specifies the number of wings for a bee. This constructor must also call the superclass constructor (Animal) to specify that all bees have 6 legs. d. walk (): You do not have to re-implement this method for this class. Recall that this method is defined as a concrete method in class Animal, which means you can use the version implemented in the class Animal. e. eat(): This method is declared as an abstract method in the abstract class Animal therefore, any class extending Animal will have to implement this method. Provide your implementation for this method. This implementation should provide some description of what this animal eats. For example, in the case of class Bee, the eat () method can print out the following statement: Bee eats flower nectar. f. sound (): This method is declared as an abstract method in the abstract class Animal therefore, any class extending Animal will have to implement this method. Provide your implementation for this method. This implementation should provide some description of the sound this animal makes. For example, in the case of class Bee, the sound () method can print out the following statement: Bee sound is a zzz. Note: In the next steps you have to implement the FlyingAnimal interface methods for this class, since class Bee implements the FlyingAnimal interface. g. getWings (): is an abstract method defined in FlyingAnimal class. This method returns an int value of the private attribute wings and accepts no parameter. h. setWings (int wings): is an abstract method defined in FlyingAnimal class. This is a void method and accepts 1 parameter named wings to set the value of the private attribute wings. i. speed (): is an abstract method defined in FlyingAnimal class. Provide your implementation for this method, this method should print out the typical speed of this animal. For example, this method can print out the following statement: Bee speed is 6 miles/hour.
Expert Answer:
Answer rating: 100% (QA)
Below is a basic implementation of the described requirements in Java Animal class abstract class An... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
The figure shows three displacement vectors A, B, and C. These vectors are arranged in tail-to-head fashion, and they add together to give a resultant displacement R, which lies along the x axis....
-
Using your computer or podcast player listen to"Reasonable Suspicion" from The Briefing Room podcast. Today's briefing is aboutTerry v. Ohio, the 1968 U.S. Supreme Court case that set the standards...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
A chamber contains a mixture of CO2, CO and O2 is in equilibrium at a specified temperature and pressure. How will (a) Increasing the temperature (T) at constant pressure and (b) Increasing the...
-
On October 11, 2014, Usher Company purchased a building for $2,250,000. The building, land, and land improvements were valued at $1,440,000, $840,000, and $120,000 respectively. Prepare the journal...
-
What are the inputs and the outputs of the Google business?
-
Suppose you are testing Exercise 7 at Do you still make the same decision? Explain your reasoning.
-
In its 2009 annual report, Campbell Soup Company reports beginning-of-the-year total assets of $6,474 million, end-of-the-year total assets of $6,056 million, total sales of $7,586 million, and net...
-
Develop an LP model to determine whether there are any arbitrage opportunities with the spot currency rates given in the file. Note that an arbitrage opportunity could involve several currencies. If...
-
A home-team baseball victory produces benefits for residents (in terms of hometown pride) that is both nonrival and nonexcludable. The graph on the right depicts the marginal benefits that Beatrice,...
-
The future value of $10,000 placed in a savings account will depend on Group of answer choices the interest rate the time it is left in the account both the interest rate and the time it is left in...
-
What did the NFL do to create much needed visibility for corporate sponsors during the football season when fans were not allowed at games due to the virus?
-
The Haines Corporation shows the following financial data for 20X1 and 20X2: Sales Cost of goods sold Selling & administrative expense Gross profit Operating profit Interest expense Income before...
-
From the trial balance of Hugo's Cleaners , ?prepare the following for August: 1 . ?Income Statement 2 . ?Statement of?owner's equity 3 . ?Balance sheet Trail Balance: Hugo's Cleaners Trial Balance...
-
Below is the change in stock for Dow Jones Index for the month of January through July. In the Monthly Change in Stock, create a formula that you can copy down that will calculate the monthly change...
-
-> 14.8 The following information has been extracted from the books of Nimmo Limited for the year to 31 December 20X9: Profit and Loss Accounts for year to 31 December 20X8 000 20X9 000 Profit before...
-
1. Ceiser Company manufactures a product called H65. The material and labour standards to make one unit of the finished good H65 are set by the company's managers. Ceiser Company plans to use 5.5...
-
Q1) What is the a3 Value Q2) What is the a7 Value Q3) What is the a4 Value Q4) What is the b3 Value Q5) What is the b2 Value Q6) What is the sign of 2nd constraint? A pastry chef at a bakery wants to...
-
Write an application that determines which, if any, of the following files are stored in the folder where you have saved the exercises created in this chapter: autoexec.bat, CompareFolders.java,...
-
Use the web to locate the lyrics to the traditional song The Twelve Days of Christmas. The song contains a list of gifts received for the holiday. The list is cumulative so that as each day passes, a...
-
Create a lottery game application. Generate three random numbers, each between 0 and 9. Allow the user to guess three numbers. Compare each of the users guesses to the three random numbers and...
-
25. Which of the following is true about the statement of cash flows for the proprietary funds of a state or local government? a. The indirect method of reporting cash flows from operating activities...
-
18. Which of the following is not necessary for a special purpose local government to be viewed as a primary government for reporting purposes? a. It must have a separately elected governing body. b....
-
17. Which of the following is true about the managements discussion and analysis (MD&A)? a. It is an optional addition to the comprehensive annual financial report, but the GASB encour ages its...
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App