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:
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
-
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...
-
Find all real values of x for which f(x) = 0. 1. f(x) = 15 3x 2. f(x) = 4x + 6 3. f(x) = 3x - 4/5 4. f(x) = 12 x2/8
-
Elliott Company, a manufacturer of tennis rackets, started production in November 2013. For the preceding 5 years, Elliott had been a retailer of sports equipment. After a thorough survey of tennis...
-
Identify the main drawbacks of a corporate firm.
-
1. Calculate the price-to-rent ratios for the following properties arranged by price of home followed by likely annual rental income: (a) $400,000/$40,000; (b) $300,000/$36,000; (c) $200,000/30,000....
-
estion 45: Which key lets you select multiple worksheets in a workbook? swer: (Shift) 13 (Tab) O (Alt) O (Enter)
-
As the manager of a focus group company, you are interested in optimizing the number of participants you include in focus groups for your clients. Over the past year, you ran a field experiment,...
-
Exxon Co purchased a new natural gas deposit for $3M. Exxon believes they can extract 1.5 million cubic feet of natural gas. In year 1, they extracted 500,000 cubic feet of natural gas and sold...
-
1. Which risk management method would you advise mining companies to use, root cause analysis method, Incident Cause Analysis method (ICAM ), Fault Tree Analysis( FTA ), and Bowie analysis? And how...
-
Chart of accounts You can find your chart of accounts in the excel template in the CANVAS shell Account Number Account name 10001 Cash at Bank 10010 Accounts Receivable < E H 10020 Inventory ......
-
An airplane traveling at 60 m/s comes to a stop in 10 seconds. Calculate the airplane's acceleration. Show the appropriate formula and show your work with units in order to receive credit.
-
Activity-Communication Gone Bad Think about three incidents in your personal or business experience, where communication between yourself and other people didn't go well. Reflect upon three different...
-
How do you explain the growing popularity of teams in organizations? What are the differences among downward, upward, and lateral communication? How is mentoring valuable to leadership? What are...
-
At 12/31/20. your company, a retailer's inventory data was provided in the table below: Inventory Number Cost unit Replacement Selling Ceiling Floor Market of Units cost/unit price unit 500 200 300...
-
The following selected information was taken from Sun Valley Citys general fund statement of revenues, expenditures, and changes in fund balance for the year ended December 31, 2019: Revenues:...
-
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...
-
Figure 5 shows a scatterplot for the variables number of farms and mean farm size in the United States. Each dot represents data from a single year between 1950 and 2000; on this diagram, the earlier...
-
The scatterplots in Figure 6 show two weeks of data comparing the actual high temperature for the day with the same-day forecast (part a) and the three-day forecast (part b). Estimate the correlation...
-
Youve conducted a study to determine how the number of calories a person consumes in a day correlates with time spent in vigorous bicycling. Your sample consisted of ten women cyclists, all of...
Study smarter with the SolutionInn App