Question: In full Java, Create a Panda class and test it with a TestPanda class. The Panda class consists of the following components. PropertiesInstance data fields

In full Java, Create a Panda class and test it with a TestPanda class. The Panda class consists of the following components.

PropertiesInstance data fields (using public access modifier)

weight: double

age: double

Class data fields (using public final static modifier)

num_leg: int

Constructors

Blank (no-argument) constructor: the constructor that has no parameter

Standard constructor: the constructor with the same number of parameters as instance properties.

Behaviors (Methods) -toPrint(): no return, print the name and current value of every property.

climb(): no return, describe how the panda climbs using an output statement, for example, it climbs slowly after a meal.

In the main function of the TestPanda class,

Create two Panda objects, one from the no-argument constructor, and the other from the standard constructor. For the latter object from the standard constructor, a value should be read from the user with proper prompts for every property.

At the end, call every method from each object.

For both objects, change every property's value using assignment statements, with values read from the user.

Call every method from each object one more time.

Test scenarios and sample outputs:

panda1 is created using the no-arg constructor. panda2 will be created using the standard constructor, please enter its weight and age: 22.2 2.5 panda1.toPrint(): weight: 100.50 age: 2.50 number of legs: 4 panda1.climb(): I slowly climb just after a meal of bamboo shooters. panda2.toPrint(): weight: 22.20 age: 2.50 number of legs: 4 panda2.climb(): I slowly climb just after a meal of bamboo shooters. Let's change the properties of panda1, please enter its weight and age: 11.1 1.5 Let's change the properties of panda2, please enter its weight and age: 22.5 2.5 panda1.toPrint(): weight: 11.10 age: 1.50 number of legs: 4 panda1.climb(): I slowly climb just after a meal of bamboo shooters. panda2.toPrint(): weight: 22.50 age: 2.50 number of legs: 4 panda2.climb(): I slowly climb just after a meal of bamboo shooters.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!