Question: Write a complete C++ program that creates an Alligator class and uses objects of this class. The Alligator class consists of following components. Properties (using

Write a complete C++ program that creates an Alligator class and uses objects of this class. The Alligator class consists of following components.

Properties (using public access modifier):

weight: double

num_leg: int

age: double

Constructors:

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

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

Methods:

to Print(): no return, print the name and current value of every property.

swim(): no return, describe how the alligator swims using an output statement, for example, it swim slowly after a meal.

The main() function should be placed below the Alligator class, inside the same source file as the Alligator class.

In the main() function, do the following actions:

Create two Alligator objects, one from the no-argument constructor, and another 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.

Step by Step Solution

3.40 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To create a complete C program as described lets break it down into steps Step 1 Define the Alligator Class Well define the properties constructors and methods as mentioned cpp include using namespace ... View full answer

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 Programming Questions!