Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Every Creature has a Name, Category, Hitpoints, Level, and a boolean if the creature is Tame. The Creature class must define the following type INSIDE
Every Creature has a Name, Category, Hitpoints, Level, and a boolean if the creature is Tame.
The Creature class must define the following type INSIDE the class definition:
An enum named Category with values UNKNOWN UNDEAD, MYSTICAL, ALIEN
The Creature class must have the following private member variables:
private:
The name of the creature a string in UPPERCASE
The category of the creature an enum
The creature's hitpoints an integer
The creature's level an integer
A boolean flag indicating whether the creature is tame
The Creature class must have the following public member functions:
Constructors
Default constructor.
Defaultinitializes all private members.
Default creature name: "NAMELESS".
Booleans are defaultinitialized to False.
Default enum value: UNKNOWN
Default Hitpoints and Level:
Parameterized constructor.
@param : A reference to the name of the creature a string Set the creature's name to NAMELESS if the provided string contains nonalphabetic characters.
@param : The category of the creature a Category enum with default value UNKNOWN
@param : The creature's hitpoints an integer with default value if not provided, or if the value provided is or negative
@param : The creature's level an integer with default value if not provided, or if the value provided is or negative
@param : A flag indicating whether the creature is tame, with default value False
@post : The private members are set to the values of the corresponding parameters. The name is converted to UPPERCASE if it consists of alphabetical characters only, otherwise it is set to NAMELESS.
Hint: Notice the default argument in the parameterized constructor.
Accessors get and Mutators set
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started