Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

4 2 5 ) Develop only the class BrownBear.The superclass Beam is provided already in the testing environment. Do not duplicate code from this class

425)Develop only the class BrownBear.The superclass Beam is provided already in the testing environment. Do not duplicate code from this class in the BrownBear classA partial implementation of BrownBear is provided in the answer box below that already has fields hibernating of type boolean and name of type String as well as getter and setter methods for these.(a) Amend the header of class BrownBear in the answer box below, to make it a subclass of Bear.(b) Add a public constructor for BrownBear.It should initialise name from the received parameter species to "Brown Bear" habitat to "Asia" hibernatingto false(c) Add a public method addfood that adds a food to foods. The method receives a string parameter representing the food and does not return a value.(d) Add a public method food Frequency that returns an int representing how many times the food passed as a parameter occurs in foods(e) Override the Bear tostring method so that depending on the value of hibernating it appends either:and is hibernating"" and is not hibernating"and then the name of the bear.For example, for a non-hibernating Brown Bear named Fuzzy whose habitat is Asia the method should addA bear of species Brown Bear which lives in Asia and is not hibernatingName: Fuzzyto the string returned by the Bean tostring method.(f) Override the equals method inherited from Bear so that it returns true if the objects compared are the same class or subclass and their species and name are the same.wtv
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions