Write C++ program: In this program, we will create a class called Camel. Below, we will describe what will define a Camel. You will also create a main function in which you will create objects of type Camel to test the functionality of your new user-defined type. In the main, you will create enough objects of your new type(s) in order to adequately test their functions. It is up to you to do this properly. Your Camel class is to contain the following: Member variables: • a float for weight • a short for age (months) • a string for the name • a char for gender • a bool to indicate whether alive (or not) Member functions: • a default constructor that creates a dead camel • a constructor that you can pass values to so as to establish its gender, weight, age, and name; it will default to alive. • a print function that will output to the screen the attributes of that camel in a nice, easy-to-read format. • an age_me function that returns nothing but increments the object's age. • an eat function that increases the weight of the camel by a random amount from 0.1% to 5.0% of the camel's current weight. Note: Think very carefully about writing the above functions and how they should be used. There are indeed circumstances when some functions should not execute. For example, a dead camel shouldn't eat anything Important :
Write C++ program:
In this program, we will create a class called Camel. Below, we will describe what will define a Camel. You will also create a main function in which you will create objects of type Camel to test the functionality of your new user-defined type. In the main, you will create enough objects of your new type(s) in order to adequately test their functions. It is up to you to do this properly. Your Camel class is to contain the following:
Member variables:
• a float for weight
• a short for age (months)
• a string for the name
• a char for gender
• a bool to indicate whether alive (or not) Member functions:
• a default constructor that creates a dead camel
• a constructor that you can pass values to so as to establish its gender, weight, age, and name; it will default to alive.
• a print function that will output to the screen the attributes of that camel in a nice, easy-to-read format.
• an age_me function that returns nothing but increments the object's age.
• an eat function that increases the weight of the camel by a random amount from 0.1% to 5.0% of the camel's current weight.
Note: Think very carefully about writing the above functions and how they should be used. There are indeed circumstances when some functions should not execute. For example, a dead camel shouldn't eat anything
Important :
write a complete report with use a cover page
Step by step
Solved in 2 steps with 1 images