Question: In the Penguin class, declare the following private fields: string color integer age string name and define the following public methods: getColor ( ) has

In the Penguin class, declare the following private fields:
string color
integer age
string name
and define the following public methods:
getColor() has no parameters and returns the color field.
getAge() has no parameters and returns the age field.
getName() has no parameters and returns the name field.
Ex: If the input is tan 10 Tia, then the output is:
Color: tan
Age: 10
Name: Tia
Note: If a field is not properly declared as private, an error message will be output.

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!