Answered step by step
Verified Expert Solution
Link Copied!

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.
Default-initializes all private members.
Default creature name: "NAMELESS".
Booleans are default-initialized to False.
Default enum value: UNKNOWN
Default Hitpoints and Level: 1.
*/
/**
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 non-alphabetic characters.
@param : The category of the creature (a Category enum) with default value UNKNOWN
@param : The creature's hitpoints (an integer), with default value 1 if not provided, or if the value provided is 0 or negative
@param : The creature's level (an integer), with default value 1 if not provided, or if the value provided is 0 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

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

Power Bi And Azure Integrating Cloud Analytics For Scalable Solutions

Authors: Kiet Huynh

1st Edition

B0CMHKB85L, 979-8868959943

More Books

Students also viewed these Databases questions

Question

Write a letter asking them to refund your $1,500 down payment.

Answered: 1 week ago