Question: CSCE 2 0 0 4 : Programming Foundations 1 Homework 7 Due: 5 / 0 2 / 2 4 Problem Statement So , you ve
CSCE : Programming Foundations
Homework
Due:
Problem Statement
So youve mastered dice rolling, now its time to start playing! The purpose of this assignment is
to create a basic Character class for Dungeons & Dragons. The Character class will store various
information about a character, including their name, character class, hit points, and more! Once
the Character class is working, you will implement a character creator in your main function
that will let the user create multiple characters and save each character into its own txt file.
Required Methods
You have been supplied with the Character.h file. Here are the descriptions of the functions that
should be implemented in Character.cpp There are comments in your starter code that also
help explain more, including which parameters are passbyreference or passbyvalue.
Default Constructor
a Parameters: none
This function initializes all the instance variables for the Character object to their
starter values. This includes generating random stats for the character. Because we
do not know the class yet, we cannot generate hit points yet.
Parameterized Constructor
a Parameters: two strings the name and class an integer the level and a
boolean
This function initializes all the instance variables to the respective parameter. It then
generates random stats and then the characters hit points.
Copy Constructor
a Parameters: another Character object
This function creates a copy of the Character object that is passed in
Destructor provided
a Parameters: none
This function reallocates memory upon the end of the program.
Getters
a Parameters: none, except for getStat which will take the index of the stat
b Returns: the appropriate type of the instance variable being retrieved
Setters
a Parameters: the appropriate type of the instance variable being set
b Returns: none
print provided
a Parameters: none
b Returns: none
This function prints out all the information about a Character.
saveCharacterSheet
a Parameters: none
b Returns: true if a sheet was successfully made, false otherwise
This function will create a txt file that stores all of the information about a Character.
The file should be the characters name with the txt extension.
generateSpellList
a Parameters: an array of all possible spells and the size of said array
b Returns: none
This function will randomly assign spells from the array of all possible spells to the
characters spells. There should be no repeat spells on the characters list.
generateRandomStats
a Parameters: none
b Returns: none
This function will randomly generate and save a number for each of the characters
stats between and
generateHitPoints provided
a Parameters: none
b Returns: none
This function will generate the characters hit points based off their class, level, and
constitution score.
reset
a Parameters: none
b Returns: none
This function reset all the instance variables for the Character object to their starter
values. This includes generating new, random stats and new hit points for the
character.
readInSpells to be implemented in hwcpp
a Parameters: the name of the file containing the complete list of spells and an
array to store those spells in
b Returns: true if the spells are successfully stored, false otherwise
This function will read each line from a file containing the complete list of spells and
store each spell in the array.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
