Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The TestLionPine.cpp (i.e main.cpp) file contains only the main function for testing the Lion class and Pine class. In the main() function create two Lion

image text in transcribed

image text in transcribed

The TestLionPine.cpp (i.e main.cpp) file contains only the main function for testing the Lion class and Pine class. In the main() function create two Lion objects and two Pine objects respectively. For each class, create one from the no-argument constructor, another from the standard constructor. Before calling the standard constructor, two values should be read from the user with proper prompts. At the end, call every method from each object. Preferably, follow the sequence below: 1. Call the get() methods within cout statements to display original property value. 2. Call the set() methods to change property values. For each property, or for each seto method, a new property value should be read from the user with proper prompt. 3. Call the toPrint method to print the updated property values with proper prompt text. 4. Call other regular methods. Part-2: Carry 6 marks. Create one project file for the following project and upload it to as a 2nd file under homework-3 in the Canvas. Use Your First Name + Your Last Name + Part-2 - HW3. For example Ashok_patel_Part2_HW3.zip. Write a complete C++ program that defines, implements, and utilizes a Lion class and a Pine class. Definition of classes from the implementation of the classes should be split. The program is made of five files: Lion.h, Lion.cpp, Pine.h, Pine.cpp, and TestLionPine.cpp. The components of Lion class are defined in the Lionh file; however, all constructors and methods should not have any implementation code in this header file. All implementation code, i.e. constructor body and method body, should be written in Lion.cpp, which refers to the Lion.h using an include directive. The Lion class consists of following components. Properties (MUST be private) weight: double height: double Constructors No-argument constructor: the constructor with no parameter Standard constructor with the same number of parameters as properties. Methods For each private property, create one get() method and one set() method to provide reading and writing access to this property. Here, there should be two get0 methods and two set() methods to Print(): no return. It prints out the names and current values of all properties. eat(): no return, print with a complete sentence how this type of lions eat. For example, eat every 48 hours, eat meat only, or eat much more in rainy season. The components of Pine class are defined in the Pine h file; however, all constructors and methods should not have any implementation code in this header file. All implementation code, i.e. constructor body and method body, should be written in Pine.cpp, which refers to the Pine h using an include directive. The Pine class consists of following components Properties (MUST be private) o age: int height: double Constructors No-argument constructor: the constructor with no parameter Standard constructor with the same number of parameters as properties Methods . For each private property, create one get() method and one set() method to provide reading and writing access to this property. Here, there should be two get() methods and two set() methods. to Print(): no return. It prints out the names and current values of all properties. produceCone(): no return, print with a complete sentence how this type of pine tree grows its pinecone. For example, produce annually, or produce on new branches. The TestLionPine.cpp (i.e main.cpp) file contains only the main function for testing the Lion class and Pine class. In the main() function create two Lion objects and two Pine objects respectively. For each class, create one from the no-argument constructor, another from the standard constructor. Before calling the standard constructor, two values should be read from the user with proper prompts. At the end, call every method from each object. Preferably, follow the sequence below: 1. Call the get() methods within cout statements to display original property value. 2. Call the set() methods to change property values. For each property, or for each seto method, a new property value should be read from the user with proper prompt. 3. Call the toPrint method to print the updated property values with proper prompt text. 4. Call other regular methods. Part-2: Carry 6 marks. Create one project file for the following project and upload it to as a 2nd file under homework-3 in the Canvas. Use Your First Name + Your Last Name + Part-2 - HW3. For example Ashok_patel_Part2_HW3.zip. Write a complete C++ program that defines, implements, and utilizes a Lion class and a Pine class. Definition of classes from the implementation of the classes should be split. The program is made of five files: Lion.h, Lion.cpp, Pine.h, Pine.cpp, and TestLionPine.cpp. The components of Lion class are defined in the Lionh file; however, all constructors and methods should not have any implementation code in this header file. All implementation code, i.e. constructor body and method body, should be written in Lion.cpp, which refers to the Lion.h using an include directive. The Lion class consists of following components. Properties (MUST be private) weight: double height: double Constructors No-argument constructor: the constructor with no parameter Standard constructor with the same number of parameters as properties. Methods For each private property, create one get() method and one set() method to provide reading and writing access to this property. Here, there should be two get0 methods and two set() methods to Print(): no return. It prints out the names and current values of all properties. eat(): no return, print with a complete sentence how this type of lions eat. For example, eat every 48 hours, eat meat only, or eat much more in rainy season. The components of Pine class are defined in the Pine h file; however, all constructors and methods should not have any implementation code in this header file. All implementation code, i.e. constructor body and method body, should be written in Pine.cpp, which refers to the Pine h using an include directive. The Pine class consists of following components Properties (MUST be private) o age: int height: double Constructors No-argument constructor: the constructor with no parameter Standard constructor with the same number of parameters as properties Methods . For each private property, create one get() method and one set() method to provide reading and writing access to this property. Here, there should be two get() methods and two set() methods. to Print(): no return. It prints out the names and current values of all properties. produceCone(): no return, print with a complete sentence how this type of pine tree grows its pinecone. For example, produce annually, or produce on new branches

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

Students also viewed these Accounting questions