Question: Bear.java implement the class Bear as specified in the UML class diagram Check whether the class includes a setter for the field If that is
Bear.java implement the class Bear as specified in the UML class diagram Check whether the class includes a setter for the field If that is the case call the setter in the constructor to initialize the field The method eat prints "eating" and increases weight by 10% The method hibernate prints "hibernating" and decreases weight by 30% Recommendation Pay close attention to the number and type of parameters as well Bear int + getWeight ): int + setWeight (w int) - eat O + hibenate) as the return types BearApp.java In the main method do the following Create an instance of Bear and name it myBear. Set its weight to a specified amount . ### lbs * Print the weight of the bear ( make sure to access the field value ) Make the bear eat (each time the bear eats its weight increases by 10%) * increase the weight of the bear by 10% every time it eats .Again print the weight of the bear ( make sure to access the field value) Make the bear eat several times and print the same results Make the bear hibernate (the bears weight decreases by 30% during hibernation) Make the bear awake and print the new weight of the bear . Make the output look like the output provided below Output MyBear weighs ### lbs. eating MyBear now weighs ### lbs. eating MyBear now weighs ### lbs. eating MyBear now weighs ### lbs. hibernating MyBear now awake and weighs ### lbs
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
