In this project, you 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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Code C++

 

In this project, you 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 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' 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.

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education