Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

In full code in 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Vi Special Issue On Database And Expert Systems Applications Lncs 7600

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2012th Edition

3642341780, 978-3642341786

More Books

Students also viewed these Databases questions