Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

toPrint(): 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

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

Database Marketing The New Profit Frontier

Authors: Ed Burnett

1st Edition

0964535629, 978-0964535626

More Books

Students also viewed these Databases questions

Question

Describe the Information distortion and the bullwhip effect.

Answered: 1 week ago