SlideShare a Scribd company logo
1 of 13
Download to read offline
Character.cpp/hpp given:
Character.cpp:
#include "Character.hpp"
/**
Default constructor.
Default-initializes all private members.
Default character name: "NAMELESS".
Booleans are default-initialized to False.
Default enum value: NONE.
Default Vitality, Max Armor, and Level: 0.
*/
Character::Character():name_{"NAMELESS"},race_{NONE},vitality_{0},armor_{0},level_{0}
,enemy_{false}
{
}
/**
Parameterized constructor.
@param : The name of the character (a string in UPPERCASE)
@param : The race of the character (a string)
@param : The character's vitality (a non-negative integer) , with default value 0
@param : The character's max armor level (a non-negative integer), with default value 0
@param : The character's level (a non-negative integer), with default value 0
@param : A flag indicating whether the character is an enemy, with default value false
@post : The private members are set to the values of the corresponding parameters.
Hint: Notice the default arguments in the parameterized constructor.
If the given parameters are invalid, the default values are used instead.
*/
Character::Character(const std::string& name, const std::string& race, int vitality, int armor, int
level, bool enemy) : Character()
{
setName(name); // checks valid name
setRace(race); // checks valid race
(vitality >= 0) ? vitality_ = vitality: vitality_ = 0;
(armor >= 0) ? armor_ = armor: armor_ = 0;
(level >= 0) ? level_ = level: level_ = 0;
enemy_ = enemy;
}
/**
@param : the name of the Character
@post : sets the Character's title to the value of the parameter, in UPPERCASE. Only
alphabetical characters are allowed. For example, attempting to create a character named
"TW3EDLEDUM2" should create a character named "TWEDLEDUM".
: If the given parameter does not have any valid alphabetical characters, the character's name
should be set to "NAMELESS".
*/
void Character::setName(const std::string& name)
{
std::string nameUpper = "";
for(int i = 0; i= 0 : Characters cannot have negative health
@post : sets the vitality private member to the value of the parameter
*/
void Character::setVitality(const int& vitality)
{
if (vitality >= 0)
{
vitality_ = vitality;
}
}
/**
@return : the value stored in vitality_
*/
int Character::getVitality() const
{
return vitality_;
}
/**
@param : an integer armor level
@pre : armor >= 0 : Characters cannot have negative armor
@post : sets the armor private member to the value of the parameter
*/
void Character::setArmor(const int& armor)
{
if (armor >= 0)
{
armor_ = armor;
}
}
/**
@return : the value stored in armor_
*/
int Character::getArmor() const
{
return armor_;
}
/**
@param : an integer level
@pre : level >= 0 : Characters cannot have a negative
@post : sets the level private member to the value of the parameter
*/
void Character::setLevel(const int& level)
{
if (level >= 0)
{
level_ = level;
}
}
/**
@return : the value stored in level_
*/
int Character::getLevel() const
{
return level_;
}
/**
@post : sets the enemy flag to true
*/
void Character::setEnemy()
{
enemy_ = true;
}
/**
@return true if the character is an enemy, false otherwise
Note: this is an accessor function and must follow the same convention as all accessor functions
even if it is not called getEnemy
*/
bool Character::isEnemy() const
{
return enemy_;
}
Character.hpp:
Now the following is what you have to do regarding character file:
Now you have to do the same for character file for the following task where you have code given
and need to modify the functions:
ArrayBag.cpp
Array bag.hpp
Then do this
After that you do this,
Please do above all well, implement the tavern task and modify the character and arraybag,
please do all well. Send me any questions if you, make sure the code would compile well.
Send all the files: character.cpp, character.hpp, arraybag.cpp, arraybag.hpp, tavern.hpp,
tavern.cpp. Make sure you send all of them and you modify the first 4 and implement the other 2.
My code that I did so far
Character.cpp:
Character.hpp:
ArrayBag.cpp:
ArrayBag.hpp:
And this is the tavern class, the one that does not match the requirements listed in directions and
is not getting points on gradescope:
Tavern.cpp:
Tavern.hpp:
void Character: setVitality(const int& vitality) { if (vitality >=0 ) vitality = vitality; } int
Character: : getVitality() const { return vitality_; } void Character: : setArmor(const int&
armor) { if ( armor >=0 ) armor =armor; } int Character: :getArmor() const { return armor_; }
void Character: : setLevel(const int& level) { if (level >=0) level_ = level; } int Character: :
getLevel() const { return level_; } void Character: : setEnemy() { enemy_ = true; } bool
Character: : isEnemy() const { return enemy_; } bool Character: : operator ==( const
Character& rhs) const { return name_ == rhs.name_ && race == rhs.race_ && level_ == rhs.
level_ && enemy_ == rhs.enemy_; } bool Character: : operator !=( const Character& rhs) const
{ return ! (*this == rhs); } void Character: : display() const { std: : cout name_ " is a Level "
level_ " " getRace() ". nVitality: " < vitality_ "nMax Armor: " < armor_ "n" (enemy_ ?
"They are" : "They are not") " an enemy. n"; }
item_count_ =0; } // end clear /** @return the number of times an_entry is found in items_ /
template int ArrayBag> : : getFrequency0f (const ItemType& an_entry) const { int frequency
=0; int curr_index =0; // Current array index while (curr_index < item_count_) { if
(items_[curr_index] == an_entry) { frequency++; } // end if curr_index++; // Increment to next
entry } // end while return frequency; } // end getFrequencyof /** @return true if an_entry is
found in items_, false otherwise **/ template bool ArrayBag> : : contains (const ItemType&
an_entry) const { return getIndex0f(an_entry) > -1 ; } // end contains // *************
PRIVATE METHODS ***k*****k*k********// /** @param target to be found in items_
@return either the index target in the array items_or -1 , if the array does not containthe target. /
template int ArrayBag> : : getIndex0f(const ItemType& target) const { bool found = false; int
result =1; int search_index =0; // If the bag is empty, item_count_ is zero, so loop is skipped
while (!found && (search_index < item_count_)) { if (items_[search_index] == target) { found
= true; result = search_index; } else { search_index++; } // end if } // end while return result;
} // end getIndex 0f
#include "ArrayBag.hpp" /** default constructor**/ template ArrayBag: :ArrayBag ():
item_count_(0) { } // end default constructor /** @return item_count_: the current size of the
bag **1 template int ArrayBag> : : getCurrentSize() const { return item_count_; } // end
getCurrentSize /** @return true if item_count_ ==0, false otherwise **1 template bool
ArrayBag> : : isEmpty() const { return item_count_ =0; } // end isEmpty /** @return true if
new_entry was successfully added to items_, false otherwise **1 template bool ArrayBag> : add
(const ItemType& new_entry) { bool has_room = (item_count_ < DEFAULT_CAPACITY); if
(has_room) { items_[item_count_] = new_entry; item_count_++; return true; } // end if return
false; } // end add /** @return true if an_entry was successfully removed from items_, false
otherwise **/ template bool ArrayBag: : remove(const ItemType& an_entry) { int found_index
= getIndex0f(an_entry); bool can_remove =! isEmpty () && (found_index >1 ); if
(can_remove) { item_count_--; items_[found_index] = items_[item_count_] ; } // end if return
can_remove; } // end remove /** @post item_count_ ==0 **1 template void ArrayBag: : clear()
{
#ifndef TAVERN_HPP_ #define TAVERN_HPP_ #include "ArrayBag.hpp" #include
"Character.hpp" class Tavern : public ArrayBag>{ public: Tavern (); bool enterTavern(const
Character& new_character); bool exitTavern(const Character& character_to_remove); int
getLevelSum() const; double calculateAvgLevel() const; int getEnemyCount () const; double
calculateEnemyPercentage() const; int tallyRace(const std: :string & race) const; void
tavernReport() const; private: int level_sum_; int enemy_count_; } ; #endif
#ifndef ARRAY_BAG_ #define ARRAY_BAG_ #include #include template class
ArrayBag { public: /*** default constructor*w/ ArrayBag (); /** @return item_count_: the
current size of the bag *ak/ int getCurrentSize() const; /*** greturn true if item_count_ ==0,
false otherwise *ak/ bool isEmpty() const; /*** @return true if new_entry was successfully
added to items_, false otherwise **k/ bool add(const ItemType &new_entry); / @return true if
an_entry was successfully removed from items_, false otherwise / bool remove(const ItemType
&an_entry); /** @post item_count_ ==0 **/ void clear(); /** @return true if an_entry is found
in items_, false otherwise **/ bool contains (const ItemType &an_entry) const; /** @return the
number of times an_entry is found in items_ *ok/ int getFrequency0f(const ItemType
&an_entry) const; protected: static const int DEFAULT_CAPACITY =100; //max size of
items_ at 100 by default for this project ItemType items_[DEFAULT_CAPACITY]; // Array of
bag items int item_count_; // Current count of bag items /*** aparam target to be found in items_
@return either the index target in the array items_or -1 , if the array does not contain the target. /
int getIndex0f(const ItemType ) const; }; // end ArrayBag #include "ArrayBag.cpp" #endif
/** ereturn : the race of the Character (a string) */ std: :string getRace() const; / @param : an
integer vitality epre : vitality >=0 : Characters cannot have negative health apost : sets the vitality
private member to the value of the parameter */ void setVitality(const int& vitality); /***
@return : the value stored in vitality_ */ int getVitality() const; /*** @param : an integer armor
level epre : armor >=0 : Characters cannot have negative armor epost : sets the armor private
member to the value of the parameter */ void setArmor(const int& armor); /*** @return : the
value stored in armor_ */ int getArmor() const; /*** @param : an integer level epre : level >=0 :
Characters cannot have a negative apost : sets the level private member to the value of the
parameter */ void setLevel(const int& level); /*** @return : the value stored in level_ */ int
getLevel() const; /*** @post : sets the enemy flag to true */ void setEnemy(); /*** @return true
if the character is an enemy, false otherwise Note: this is an accessor function and must follow
the same convention as all acces */ bool isEnemy() const;
#include "Tavern.hpp" #include #include Tavern: :Tavern () : level_sum_( 0 , enemy_count_(
0){} bool Tavern: : enterTavern(const Character& new_character) { bool result = add
(new_character); if (result) { level_sum_ += new_character.getLevel( ); if
(new_character.isEnemy()) { enemy_count_++; } } return result; } bool Tavern:
:exitTavern(const Character& character_to_remove) { bool result = remove (
character_to_remove ); if (result) { level_sum_-= character_to_remove.getLevel(); if
(character_to_remove.isEnemy()) { enemy_count_--; } } return result; } int Tavern: :
getLevelSum() const { return level_sum_; } double Tavern: : calculateAvgLevel() const {
return static_cast( level_sum_) / getCurrentSize(); } int Tavern: :getEnemyCount () const {
return enemy_count_; }
double Tavern: calculateEnemyPercentage() const { return static_cast(enemy_count_) /
getCurrentSize() * 100.0; } int Tavern: : tallyRace(const std: :string& race) const { int count
=0; for (int i=0; i< item_count_; i++) { if (items_[i].getRace ()== race) { count++; } } return
count; } void Tavern: : tavernReport() const { std: : cout "Humans: " < tallyRace ("HUMAN")
< "nElves: " < tallyRace("ELF") < "nDwarves: " < tallyRace ("DWARF") < "nLizards: " <
tallyRace("LIZARD") < "nUndead: " < tallyRace("UNDEAD") "nThe average level is: " < std:
fixed std: setprecision(2) calculateAvgLevel() "n" std: : fixed std: : setprecision(2)
calculateEnemyPercentage() "% are enemies. n"; }
Task 2: Modify the ArrayBag class Define and implement the following additional public
member functions: /** aparam: A const reference to another ArrayBag object apost: Combines
the contents from both ArrayBag objects, EXCLUDING duplicates. Example: [1,2,3]+=[1,4]
will produce [1,2,3,4] */ operator /= /** aparam: A const reference to another ArrayBag object
apost: Combines the contents from both ArrayBag objects, including duplicates, adding items
from the argument bag as long as there is space. Example: [1,2,3]+=[1,4] will produce [1,2,3,1,4]
*/ operator+=
#ifndef ARRAY_BAG_ #define ARRAY_BAG_ template class ArrayBag { public: ArrayBag
( ); int getCurrentSize() const; bool isEmpty() const; bool add(const ItemType& new_entry);
bool remove(const ItemType& an_entry); void clear(); bool contains (const ItemType&
an_entry) const; int getFrequency0f(const ItemType& an_entry) const; ArrayBag < ItemType
>& operator /= ( const ArrayBag < ItemType >& anotherBag); ArrayBag < ItemType >&
operator += ( const ArrayBag < ItemType >& anotherBag) ; protected: static const int
DEFAULT_CAPACITY = 100; ItemType items_[DEFAULT_CAPACITY] ; int item_count_;
int getIndex0f(const ItemType& target) const; }; #include "ArrayBag.cpp" #endif
template int ArrayBag: : getFrequency0f(const ItemType& an_entry) const { int frequency =0;
for (int i=0; i< item_count_; i++){ if (items_[i] == an_entry) { frequency++; } } return
frequency; } template ArrayBag>& ArrayBag> : : operator/=(const ArrayBag < ItemType >&
anotherBag) { for (int i=0; i< anotherBag.item_count_ && item_count_ <
DEFAULT_CAPACITY; i++ ) { if (!this contains (anotherBag.items_[i])) { this add
(anotherBag.items_[i]); } } return *this; } template ArrayBag>& ArrayBag < ItemType > : :
operator +=( const ArrayBag < ItemType >& anotherBag ){ for (int i=0; i<
anotherBag.item_count_ && item_count_ < DEFAULT_CAPACITY; i++ ) { this add
(anotherBag.items_[i]); } return *this; } template int ArrayBag> : getIndex0f(const
ItemType& target) const { for (int i=0; i< item_count_; i++ ) { if (items_[i] == target) { |
return i; } } return -1; }
template> ArrayBag: :ArrayBag() : item_count_(0) {} template int ArrayBag: :
getCurrentSize() const { return item_count_; } template bool ArrayBag: : isEmpty() const {
return item_count_ ==0; } template bool ArrayBag: : add(const ItemType& new_entry) { bool
has_room = item_count_ < DEFAULT_CAPACITY; if (has_room) { items_[item_count_] =
new_entry; item_count_++; return true; } return false; } template bool ArrayBag: :
remove(const ItemType& an_entry) { int found_index = getIndex0f(an_entry); bool
can_remove = ! isEmpty () && (found_index >1 ); if (can_remove) { item_count_--;
items_[found_index] = items_[item_count_]; } return can_remove; } template void
ArrayBag=0; } template bool ArrayBag: : contains(const ItemType& an_entry) const return
getIndex0f(an_entry) > -1 ; }
#include enum Race { NONE, HUMAN, ELF, DWARF, LIZARD, UNDEAD }; class
Character { public: Character(); Character(const std: :string& name, const std: :string& race,
int vitality =0, int armor =0, int level =0, bool enemy = false); void setName(const std: : string&
name); std: :string getName() const; void setRace(const std: : string& race); std: :string
getRace() const; void setVitality(const int& vitality); int getVitality() const; void
setArmor(const int& armor); int getArmor() const; void setLevel(const int& level); int
getLevel() const; void setEnemy(); bool isEnemy() const; bool operator == (const Character &
rhs) const; bool operator!=(const Character& rhs) const; void display() const; private: std:
:string name_; Race race_; int vitality_; int armor_; int level_; bool enemy_; }; #endif //
CHARACTER_HPP_
ndef CHARACTER_HPP_ fine CHARACTER_HPP_ clude clude > clude Race NONE,
HUMAN, ELF, DWARF, LIZARD, UNDEAD Iss Character public: / Default constructor.
Default-initializes all private members. Default character name: "NAMELESS". Booleans are
default-initialized to False. Default enum value: NONE. Default Vitality, Max Armor, and Level:
0 . / Character(); / Parameterized constructor. eparam : The name of the character (a string in
UPPERCASE) eparam : The race of the character (a string) eparam : The character's vitality (a
non-negative integer), with default value 0 eparam : The character's max armor level (a non-
negative integer), with default value 0 eparam : The character's level (a non-negative integer),
with default value 0 eparam : A flag indicating whether the character is an enemy, with default
value false apost : The private members are set to the values of the corresponding parameters.
Hint: Notice the default arguments in the parameterized constructor. / Character(const std: :string
& name, const std: :string & race, int vitality =0, int armor =0, int level =0, bool enemy = false);
/ eparam : the name of the Character @post : sets the Character's title to the value of the
parameter, in UPPERCASE. Only alphabetical characters are allowed. */ void setName(const
std: : string& name); /*** ereturn : the name of the Character */ std: :string getName() const;
/*** @param : the race of the Character (a string) epost : sets the Character's race to the value of
the parameter : If the given race was invalid, set race_ to NONE. */ void setRace(const std:
:string& race);
Define and implement the following additional public member functions: /** aparam : A const
reference to the right hand side of the == operator. areturn: Returns true if the right hand side
character is "equal", false otherwise. Two characters are equal if they have the same name, same
race, same level and are either both an enemy or not. NOTE: By this definition, only the
aforementioned subset of the character's attributes must be equal for two characters to be deemed
"equal". Example: In order for character1 to be == to character2 we only need: - The same name
- The same race - The same level - They must either be both an enemy or not */ operator== /**
aparam ': A const reference to the right hand side of the != operator. areturn : Returns true if the
right hand side character is NOT "equal" (!=), false otherwise. Two characters are NOT equal if
any of their name, race or level are not equal, or if one is an enemy and the other is not. NOTE:
By this definition, one or more of the aforementioned subset of the character's attributes only
must be different for two characters to be deemed "NOT equal". */ operator != /** apost :
displays Character data in the form: "[name_] is a Level [level_] [race_]. nVitality: [vitality_]
nMax Armor: [armor_] n[ They are / They are not] an enemy. n" / display
Task 3: Implement the Tavern class as a subclass of ArrayBag The Tavern is subclass of
ArrayBag that stores Character objects Data Types The Tavern class must have the following
private member variables: - An integer sum of the levels of all the characters currently in the
tavern - An integer count of all the characters currently in the Tavern that are marked as enemies
The Tavern class must have the following public member functions: Constructor /** Default
constructor. */ Default-initializes all private members. /** Default constructor. Default-initializes
all private members. */
Inique Methods /** aparam: A const reference to a Character entering the Tavern (areturn:
returns true if a Character was successfully added to the tavern (i.e. items_), false otherwise
apost: adds Character to the Tavern and updates the level sum and the enemy count if the
character is an enemy. **/ enterTavern /** aparam: A const reference to a Character leaving the
Tavern (areturn: returns true if a character was successfully removed from the tavern (i.e.
items_), false otherwise apost: removes the character from the Tavern and updates the level sum
and the enemy count if the character is an enemy. **/ exitTavern / areturn: The integer level
count of all the characters currently in the Tavern **/ getLevelSum /** areturn: The average
level of all the characters in the Tavern apost: Computes the average level of the Tavern rounded
to the NEAREST integer. **/ calculateAvgLevel /** areturn: The integer enemy count of the
Tavern **/ getEnemyCount /** areturn: The percentage (double) of all the enemy characters in
the Tavern apost: Computes the enemy percentage of the Tavern rounded up to 2 decimal places.
**/ calculateEnemyPercentage / aparam: A const reference to a string representing a character
Race with value in ["NONE", "HUMAN", "ElF", "DWARF", "LIZARD", "UNDEAD"] (areturn:
An integer tally of the number of characters in the Tavern of the given race. If the argument
string does not match one of the expected race values, the tally is zero. NOTE: no pre-processing
of the input string necessary, only uppercase input will match. **/ tallyRace / @post: Outputs a
report of the characters currently in the tavern in the form: "Humans: [x] nElves: [x] nDwarves:
[x] nLizards: [x] nUndead: [x] nnThe average level is: [x]n[x]% are enemies. n" Note that
the average level should be rounded to the NEAREST integer, and the enemy percentage should
be rounded to 2 decimal places. Example output: Humans: 3 Elves: 5 Dwarves: 8 Lizards: 6
Undead: 0 The average level is: 7 46.67% are enemies. */ tavernReport
#include "Character.hpp" #include #include Character::Character() : name_("NAMELESS"),
race_(NONE), vitality_(0), armor_(0), level_( 0), enemy_(false) {} Character: :Character(const
std::string& name, const std: :string& race, int vitality, int armor, int level, bool enemy) :
Character() { setName (name); setRace (race); (vitality >=0 ) ? vitality = vitality : vitality =0;
(armor >=0 ) ? armor = armor : armor =0; (level >=0) ? level_ = level : level_ =0; enemy_ =
enemy; } void Character: : setName (const std: :string& name) { std: : string nameUpper = "";
for(char c : name) { if (std: : isalpha(c)) { nameUpper += std: : toupper (c); } } name_ =
nameUpper.empty () ? "NAMELESS" : nameUpper; } std: :string Character: :getName() const
{ return name_; } void Character: : setRace (const std: :string& race) { if ( race ==
"HUMAN") race =HUMAN; else if ( race == "ELF") race_ = ELF; else if ( race == "DWARF")
race =DWARF; else if ( race == "LIZARD") race =LIZARD; else if ( race == "UNDEAD") race
=UNDEAD; else race =NONE; } std: :string Character: :getRace() const { switch (race_) {
case HUMAN: return "HUMAN"; case ELF: return "ELF"; case DWARF: return "DWARF";
case LIZARD: return "LIZARD"; case UNDEAD: return "UNDEAD"; default: return "NONE";
} } void Character: setVitality(const int& vitality) {
/** ereturn : the race of the Character (a string) */ std: :string getRace() const; / @param : an
integer vitality epre : vitality >=0 : Characters cannot have negative health apost : sets the vitality
private member to the value of the parameter */ void setVitality(const int& vitality); /***
@return : the value stored in vitality_ */ int getVitality() const; /*** @param : an integer armor
level epre : armor >=0 : Characters cannot have negative armor epost : sets the armor private
member to the value of the parameter */ void setArmor(const int& armor); /*** @return : the
value stored in armor_ */ int getArmor() const; /*** @param : an integer level epre : level >=0 :
Characters cannot have a negative apost : sets the level private member to the value of the
parameter */ void setLevel(const int& level); /*** @return : the value stored in level_ */ int
getLevel() const; /*** @post : sets the enemy flag to true */ void setEnemy(); /*** @return true
if the character is an enemy, false otherwise Note: this is an accessor function and must follow
the same convention as all acces */ bool isEnemy() const;

More Related Content

Similar to Character.cpphpp givenCharacter.cpp#include Character.hp.pdf

Swift Programming Language
Swift Programming LanguageSwift Programming Language
Swift Programming LanguageAnıl Sözeri
 
ReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfravikapoorindia
 
Write a program to find the number of comparisons using the binary se.docx
 Write a program to find the number of comparisons using the binary se.docx Write a program to find the number of comparisons using the binary se.docx
Write a program to find the number of comparisons using the binary se.docxajoy21
 
In C pls -- Write your name here -- Write the compiler used- Visual st.docx
In C pls -- Write your name here -- Write the compiler used- Visual st.docxIn C pls -- Write your name here -- Write the compiler used- Visual st.docx
In C pls -- Write your name here -- Write the compiler used- Visual st.docxBlake0FxCampbelld
 
Please answer the 4 questions using C- The expected output is shown be.docx
Please answer the 4 questions using C- The expected output is shown be.docxPlease answer the 4 questions using C- The expected output is shown be.docx
Please answer the 4 questions using C- The expected output is shown be.docxcgraciela1
 
C++ code, please help! RESPOND W COMPLETED CODE PLEASE, am using V.pdf
C++ code, please help! RESPOND W COMPLETED CODE PLEASE,  am using V.pdfC++ code, please help! RESPOND W COMPLETED CODE PLEASE,  am using V.pdf
C++ code, please help! RESPOND W COMPLETED CODE PLEASE, am using V.pdfrahulfancycorner21
 
template-typename T- class Array { public- ---------------------------.pdf
template-typename T- class Array { public- ---------------------------.pdftemplate-typename T- class Array { public- ---------------------------.pdf
template-typename T- class Array { public- ---------------------------.pdfashokadyes
 
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdf
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdfHey, I need some help coding this C++ assignment.ObjectivesThis.pdf
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdfrishabjain5053
 
Given the following errors and class in Java- How are these errors fix.pdf
Given the following errors and class in Java- How are these errors fix.pdfGiven the following errors and class in Java- How are these errors fix.pdf
Given the following errors and class in Java- How are these errors fix.pdfNicholasflqStewartl
 
-- Reminder that your file name is incredibly important- Please do not.docx
-- Reminder that your file name is incredibly important- Please do not.docx-- Reminder that your file name is incredibly important- Please do not.docx
-- Reminder that your file name is incredibly important- Please do not.docxAdamq0DJonese
 
Javascript Primer
Javascript PrimerJavascript Primer
Javascript PrimerAdam Hepton
 
please follow all instructions and answer the inbedded questions- and.pdf
please follow all instructions and answer the inbedded questions- and.pdfplease follow all instructions and answer the inbedded questions- and.pdf
please follow all instructions and answer the inbedded questions- and.pdfIan5L3Allanm
 
C++ code, please help! Troubleshooting and cannot for the life of me.pdf
C++ code, please help! Troubleshooting and cannot for the life of me.pdfC++ code, please help! Troubleshooting and cannot for the life of me.pdf
C++ code, please help! Troubleshooting and cannot for the life of me.pdfrahulfancycorner21
 
Object oriented programming; operator overloading array
Object oriented programming; operator overloading arrayObject oriented programming; operator overloading array
Object oriented programming; operator overloading arraySyed Zaid Irshad
 
Csharp4 arrays and_tuples
Csharp4 arrays and_tuplesCsharp4 arrays and_tuples
Csharp4 arrays and_tuplesAbed Bukhari
 
READ BEFORE YOU START Please read the given Word document fo.pdf
READ BEFORE YOU START  Please read the given Word document fo.pdfREAD BEFORE YOU START  Please read the given Word document fo.pdf
READ BEFORE YOU START Please read the given Word document fo.pdfinfo673628
 
Written in C- requires linked lists- Please answer the 4 questions and.pdf
Written in C- requires linked lists- Please answer the 4 questions and.pdfWritten in C- requires linked lists- Please answer the 4 questions and.pdf
Written in C- requires linked lists- Please answer the 4 questions and.pdfsravi07
 
Written in C- requires linked lists- Please answer the 4 questions and (1).pdf
Written in C- requires linked lists- Please answer the 4 questions and (1).pdfWritten in C- requires linked lists- Please answer the 4 questions and (1).pdf
Written in C- requires linked lists- Please answer the 4 questions and (1).pdfsravi07
 
written in c- please answer the 4 questions and write the functions ba.pdf
written in c- please answer the 4 questions and write the functions ba.pdfwritten in c- please answer the 4 questions and write the functions ba.pdf
written in c- please answer the 4 questions and write the functions ba.pdfsravi07
 

Similar to Character.cpphpp givenCharacter.cpp#include Character.hp.pdf (20)

Swift Programming Language
Swift Programming LanguageSwift Programming Language
Swift Programming Language
 
ReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdf
 
Write a program to find the number of comparisons using the binary se.docx
 Write a program to find the number of comparisons using the binary se.docx Write a program to find the number of comparisons using the binary se.docx
Write a program to find the number of comparisons using the binary se.docx
 
In C pls -- Write your name here -- Write the compiler used- Visual st.docx
In C pls -- Write your name here -- Write the compiler used- Visual st.docxIn C pls -- Write your name here -- Write the compiler used- Visual st.docx
In C pls -- Write your name here -- Write the compiler used- Visual st.docx
 
Please answer the 4 questions using C- The expected output is shown be.docx
Please answer the 4 questions using C- The expected output is shown be.docxPlease answer the 4 questions using C- The expected output is shown be.docx
Please answer the 4 questions using C- The expected output is shown be.docx
 
C++ code, please help! RESPOND W COMPLETED CODE PLEASE, am using V.pdf
C++ code, please help! RESPOND W COMPLETED CODE PLEASE,  am using V.pdfC++ code, please help! RESPOND W COMPLETED CODE PLEASE,  am using V.pdf
C++ code, please help! RESPOND W COMPLETED CODE PLEASE, am using V.pdf
 
template-typename T- class Array { public- ---------------------------.pdf
template-typename T- class Array { public- ---------------------------.pdftemplate-typename T- class Array { public- ---------------------------.pdf
template-typename T- class Array { public- ---------------------------.pdf
 
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdf
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdfHey, I need some help coding this C++ assignment.ObjectivesThis.pdf
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdf
 
Js hacks
Js hacksJs hacks
Js hacks
 
Given the following errors and class in Java- How are these errors fix.pdf
Given the following errors and class in Java- How are these errors fix.pdfGiven the following errors and class in Java- How are these errors fix.pdf
Given the following errors and class in Java- How are these errors fix.pdf
 
-- Reminder that your file name is incredibly important- Please do not.docx
-- Reminder that your file name is incredibly important- Please do not.docx-- Reminder that your file name is incredibly important- Please do not.docx
-- Reminder that your file name is incredibly important- Please do not.docx
 
Javascript Primer
Javascript PrimerJavascript Primer
Javascript Primer
 
please follow all instructions and answer the inbedded questions- and.pdf
please follow all instructions and answer the inbedded questions- and.pdfplease follow all instructions and answer the inbedded questions- and.pdf
please follow all instructions and answer the inbedded questions- and.pdf
 
C++ code, please help! Troubleshooting and cannot for the life of me.pdf
C++ code, please help! Troubleshooting and cannot for the life of me.pdfC++ code, please help! Troubleshooting and cannot for the life of me.pdf
C++ code, please help! Troubleshooting and cannot for the life of me.pdf
 
Object oriented programming; operator overloading array
Object oriented programming; operator overloading arrayObject oriented programming; operator overloading array
Object oriented programming; operator overloading array
 
Csharp4 arrays and_tuples
Csharp4 arrays and_tuplesCsharp4 arrays and_tuples
Csharp4 arrays and_tuples
 
READ BEFORE YOU START Please read the given Word document fo.pdf
READ BEFORE YOU START  Please read the given Word document fo.pdfREAD BEFORE YOU START  Please read the given Word document fo.pdf
READ BEFORE YOU START Please read the given Word document fo.pdf
 
Written in C- requires linked lists- Please answer the 4 questions and.pdf
Written in C- requires linked lists- Please answer the 4 questions and.pdfWritten in C- requires linked lists- Please answer the 4 questions and.pdf
Written in C- requires linked lists- Please answer the 4 questions and.pdf
 
Written in C- requires linked lists- Please answer the 4 questions and (1).pdf
Written in C- requires linked lists- Please answer the 4 questions and (1).pdfWritten in C- requires linked lists- Please answer the 4 questions and (1).pdf
Written in C- requires linked lists- Please answer the 4 questions and (1).pdf
 
written in c- please answer the 4 questions and write the functions ba.pdf
written in c- please answer the 4 questions and write the functions ba.pdfwritten in c- please answer the 4 questions and write the functions ba.pdf
written in c- please answer the 4 questions and write the functions ba.pdf
 

More from txkev

Critical Thinking 10-7 Dynamic Mobile AccessThere are so many o.pdf
Critical Thinking 10-7 Dynamic Mobile AccessThere are so many o.pdfCritical Thinking 10-7 Dynamic Mobile AccessThere are so many o.pdf
Critical Thinking 10-7 Dynamic Mobile AccessThere are so many o.pdftxkev
 
Crisis Response Instructions In Module 4, you learned that e.pdf
Crisis Response Instructions     In Module 4, you learned that e.pdfCrisis Response Instructions     In Module 4, you learned that e.pdf
Crisis Response Instructions In Module 4, you learned that e.pdftxkev
 
Create a Schedule D and schedule 1 for this information, and the cor.pdf
Create a Schedule D and schedule 1 for this information, and the cor.pdfCreate a Schedule D and schedule 1 for this information, and the cor.pdf
Create a Schedule D and schedule 1 for this information, and the cor.pdftxkev
 
Fix this code so that it will run with proper answers, please dont u.pdf
Fix this code so that it will run with proper answers, please dont u.pdfFix this code so that it will run with proper answers, please dont u.pdf
Fix this code so that it will run with proper answers, please dont u.pdftxkev
 
Five areas that financial ratios concentrate on area) liquidity.pdf
Five areas that financial ratios concentrate on area) liquidity.pdfFive areas that financial ratios concentrate on area) liquidity.pdf
Five areas that financial ratios concentrate on area) liquidity.pdftxkev
 
double Skiplist code below#include iostream#include vector.pdf
double Skiplist code below#include iostream#include vector.pdfdouble Skiplist code below#include iostream#include vector.pdf
double Skiplist code below#include iostream#include vector.pdftxkev
 
Draw a class diagram for the following scenario The following are t.pdf
Draw a class diagram for the following scenario The following are t.pdfDraw a class diagram for the following scenario The following are t.pdf
Draw a class diagram for the following scenario The following are t.pdftxkev
 
Discuss the structure of intelligent agents in artificial intelligen.pdf
Discuss the structure of intelligent agents in artificial intelligen.pdfDiscuss the structure of intelligent agents in artificial intelligen.pdf
Discuss the structure of intelligent agents in artificial intelligen.pdftxkev
 
Consider the following game in which Sally can play T or B and John .pdf
Consider the following game in which Sally can play T or B and John .pdfConsider the following game in which Sally can play T or B and John .pdf
Consider the following game in which Sally can play T or B and John .pdftxkev
 
Computer NetworksConsider the following scenario involving a.pdf
Computer NetworksConsider the following scenario involving a.pdfComputer NetworksConsider the following scenario involving a.pdf
Computer NetworksConsider the following scenario involving a.pdftxkev
 
CNA STB 14 July 2022, STB said � visitor arrival to Singapore are ex.pdf
CNA STB 14 July 2022, STB said � visitor arrival to Singapore are ex.pdfCNA STB 14 July 2022, STB said � visitor arrival to Singapore are ex.pdf
CNA STB 14 July 2022, STB said � visitor arrival to Singapore are ex.pdftxkev
 
Directions# Caesar Cipher ImplementationYour task in this homew.pdf
Directions# Caesar Cipher ImplementationYour task in this homew.pdfDirections# Caesar Cipher ImplementationYour task in this homew.pdf
Directions# Caesar Cipher ImplementationYour task in this homew.pdftxkev
 
Describe the leadership of Captain Michael Davidson and second mate .pdf
Describe the leadership of Captain Michael Davidson and second mate .pdfDescribe the leadership of Captain Michael Davidson and second mate .pdf
Describe the leadership of Captain Michael Davidson and second mate .pdftxkev
 

More from txkev (13)

Critical Thinking 10-7 Dynamic Mobile AccessThere are so many o.pdf
Critical Thinking 10-7 Dynamic Mobile AccessThere are so many o.pdfCritical Thinking 10-7 Dynamic Mobile AccessThere are so many o.pdf
Critical Thinking 10-7 Dynamic Mobile AccessThere are so many o.pdf
 
Crisis Response Instructions In Module 4, you learned that e.pdf
Crisis Response Instructions     In Module 4, you learned that e.pdfCrisis Response Instructions     In Module 4, you learned that e.pdf
Crisis Response Instructions In Module 4, you learned that e.pdf
 
Create a Schedule D and schedule 1 for this information, and the cor.pdf
Create a Schedule D and schedule 1 for this information, and the cor.pdfCreate a Schedule D and schedule 1 for this information, and the cor.pdf
Create a Schedule D and schedule 1 for this information, and the cor.pdf
 
Fix this code so that it will run with proper answers, please dont u.pdf
Fix this code so that it will run with proper answers, please dont u.pdfFix this code so that it will run with proper answers, please dont u.pdf
Fix this code so that it will run with proper answers, please dont u.pdf
 
Five areas that financial ratios concentrate on area) liquidity.pdf
Five areas that financial ratios concentrate on area) liquidity.pdfFive areas that financial ratios concentrate on area) liquidity.pdf
Five areas that financial ratios concentrate on area) liquidity.pdf
 
double Skiplist code below#include iostream#include vector.pdf
double Skiplist code below#include iostream#include vector.pdfdouble Skiplist code below#include iostream#include vector.pdf
double Skiplist code below#include iostream#include vector.pdf
 
Draw a class diagram for the following scenario The following are t.pdf
Draw a class diagram for the following scenario The following are t.pdfDraw a class diagram for the following scenario The following are t.pdf
Draw a class diagram for the following scenario The following are t.pdf
 
Discuss the structure of intelligent agents in artificial intelligen.pdf
Discuss the structure of intelligent agents in artificial intelligen.pdfDiscuss the structure of intelligent agents in artificial intelligen.pdf
Discuss the structure of intelligent agents in artificial intelligen.pdf
 
Consider the following game in which Sally can play T or B and John .pdf
Consider the following game in which Sally can play T or B and John .pdfConsider the following game in which Sally can play T or B and John .pdf
Consider the following game in which Sally can play T or B and John .pdf
 
Computer NetworksConsider the following scenario involving a.pdf
Computer NetworksConsider the following scenario involving a.pdfComputer NetworksConsider the following scenario involving a.pdf
Computer NetworksConsider the following scenario involving a.pdf
 
CNA STB 14 July 2022, STB said � visitor arrival to Singapore are ex.pdf
CNA STB 14 July 2022, STB said � visitor arrival to Singapore are ex.pdfCNA STB 14 July 2022, STB said � visitor arrival to Singapore are ex.pdf
CNA STB 14 July 2022, STB said � visitor arrival to Singapore are ex.pdf
 
Directions# Caesar Cipher ImplementationYour task in this homew.pdf
Directions# Caesar Cipher ImplementationYour task in this homew.pdfDirections# Caesar Cipher ImplementationYour task in this homew.pdf
Directions# Caesar Cipher ImplementationYour task in this homew.pdf
 
Describe the leadership of Captain Michael Davidson and second mate .pdf
Describe the leadership of Captain Michael Davidson and second mate .pdfDescribe the leadership of Captain Michael Davidson and second mate .pdf
Describe the leadership of Captain Michael Davidson and second mate .pdf
 

Recently uploaded

Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17Celine George
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdfDiuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdfKartik Tiwari
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
Orientation Canvas Course Presentation.pdf
Orientation Canvas Course Presentation.pdfOrientation Canvas Course Presentation.pdf
Orientation Canvas Course Presentation.pdfElizabeth Walsh
 
Ernest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell TollsErnest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell TollsPallavi Parmar
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfstareducators107
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...Gary Wood
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MysoreMuleSoftMeetup
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use CasesTechSoup
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfNirmal Dwivedi
 

Recently uploaded (20)

Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdfDiuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
Diuretic, Hypoglycemic and Limit test of Heavy metals and Arsenic.-1.pdf
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Orientation Canvas Course Presentation.pdf
Orientation Canvas Course Presentation.pdfOrientation Canvas Course Presentation.pdf
Orientation Canvas Course Presentation.pdf
 
Ernest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell TollsErnest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell Tolls
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
 

Character.cpphpp givenCharacter.cpp#include Character.hp.pdf

  • 1. Character.cpp/hpp given: Character.cpp: #include "Character.hpp" /** Default constructor. Default-initializes all private members. Default character name: "NAMELESS". Booleans are default-initialized to False. Default enum value: NONE. Default Vitality, Max Armor, and Level: 0. */ Character::Character():name_{"NAMELESS"},race_{NONE},vitality_{0},armor_{0},level_{0} ,enemy_{false} { } /** Parameterized constructor. @param : The name of the character (a string in UPPERCASE) @param : The race of the character (a string) @param : The character's vitality (a non-negative integer) , with default value 0 @param : The character's max armor level (a non-negative integer), with default value 0 @param : The character's level (a non-negative integer), with default value 0 @param : A flag indicating whether the character is an enemy, with default value false @post : The private members are set to the values of the corresponding parameters. Hint: Notice the default arguments in the parameterized constructor. If the given parameters are invalid, the default values are used instead. */ Character::Character(const std::string& name, const std::string& race, int vitality, int armor, int level, bool enemy) : Character() { setName(name); // checks valid name setRace(race); // checks valid race (vitality >= 0) ? vitality_ = vitality: vitality_ = 0;
  • 2. (armor >= 0) ? armor_ = armor: armor_ = 0; (level >= 0) ? level_ = level: level_ = 0; enemy_ = enemy; } /** @param : the name of the Character @post : sets the Character's title to the value of the parameter, in UPPERCASE. Only alphabetical characters are allowed. For example, attempting to create a character named "TW3EDLEDUM2" should create a character named "TWEDLEDUM". : If the given parameter does not have any valid alphabetical characters, the character's name should be set to "NAMELESS". */ void Character::setName(const std::string& name) { std::string nameUpper = ""; for(int i = 0; i= 0 : Characters cannot have negative health @post : sets the vitality private member to the value of the parameter */ void Character::setVitality(const int& vitality) { if (vitality >= 0) { vitality_ = vitality; } } /** @return : the value stored in vitality_ */ int Character::getVitality() const { return vitality_; } /** @param : an integer armor level @pre : armor >= 0 : Characters cannot have negative armor
  • 3. @post : sets the armor private member to the value of the parameter */ void Character::setArmor(const int& armor) { if (armor >= 0) { armor_ = armor; } } /** @return : the value stored in armor_ */ int Character::getArmor() const { return armor_; } /** @param : an integer level @pre : level >= 0 : Characters cannot have a negative @post : sets the level private member to the value of the parameter */ void Character::setLevel(const int& level) { if (level >= 0) { level_ = level; } } /** @return : the value stored in level_ */ int Character::getLevel() const { return level_;
  • 4. } /** @post : sets the enemy flag to true */ void Character::setEnemy() { enemy_ = true; } /** @return true if the character is an enemy, false otherwise Note: this is an accessor function and must follow the same convention as all accessor functions even if it is not called getEnemy */ bool Character::isEnemy() const { return enemy_; } Character.hpp: Now the following is what you have to do regarding character file: Now you have to do the same for character file for the following task where you have code given and need to modify the functions: ArrayBag.cpp Array bag.hpp Then do this After that you do this,
  • 5. Please do above all well, implement the tavern task and modify the character and arraybag, please do all well. Send me any questions if you, make sure the code would compile well. Send all the files: character.cpp, character.hpp, arraybag.cpp, arraybag.hpp, tavern.hpp, tavern.cpp. Make sure you send all of them and you modify the first 4 and implement the other 2. My code that I did so far Character.cpp: Character.hpp: ArrayBag.cpp: ArrayBag.hpp: And this is the tavern class, the one that does not match the requirements listed in directions and is not getting points on gradescope: Tavern.cpp: Tavern.hpp:
  • 6. void Character: setVitality(const int& vitality) { if (vitality >=0 ) vitality = vitality; } int Character: : getVitality() const { return vitality_; } void Character: : setArmor(const int& armor) { if ( armor >=0 ) armor =armor; } int Character: :getArmor() const { return armor_; } void Character: : setLevel(const int& level) { if (level >=0) level_ = level; } int Character: : getLevel() const { return level_; } void Character: : setEnemy() { enemy_ = true; } bool Character: : isEnemy() const { return enemy_; } bool Character: : operator ==( const Character& rhs) const { return name_ == rhs.name_ && race == rhs.race_ && level_ == rhs. level_ && enemy_ == rhs.enemy_; } bool Character: : operator !=( const Character& rhs) const { return ! (*this == rhs); } void Character: : display() const { std: : cout name_ " is a Level " level_ " " getRace() ". nVitality: " < vitality_ "nMax Armor: " < armor_ "n" (enemy_ ? "They are" : "They are not") " an enemy. n"; } item_count_ =0; } // end clear /** @return the number of times an_entry is found in items_ / template int ArrayBag> : : getFrequency0f (const ItemType& an_entry) const { int frequency =0; int curr_index =0; // Current array index while (curr_index < item_count_) { if (items_[curr_index] == an_entry) { frequency++; } // end if curr_index++; // Increment to next
  • 7. entry } // end while return frequency; } // end getFrequencyof /** @return true if an_entry is found in items_, false otherwise **/ template bool ArrayBag> : : contains (const ItemType& an_entry) const { return getIndex0f(an_entry) > -1 ; } // end contains // ************* PRIVATE METHODS ***k*****k*k********// /** @param target to be found in items_ @return either the index target in the array items_or -1 , if the array does not containthe target. / template int ArrayBag> : : getIndex0f(const ItemType& target) const { bool found = false; int result =1; int search_index =0; // If the bag is empty, item_count_ is zero, so loop is skipped while (!found && (search_index < item_count_)) { if (items_[search_index] == target) { found = true; result = search_index; } else { search_index++; } // end if } // end while return result; } // end getIndex 0f #include "ArrayBag.hpp" /** default constructor**/ template ArrayBag: :ArrayBag (): item_count_(0) { } // end default constructor /** @return item_count_: the current size of the bag **1 template int ArrayBag> : : getCurrentSize() const { return item_count_; } // end getCurrentSize /** @return true if item_count_ ==0, false otherwise **1 template bool ArrayBag> : : isEmpty() const { return item_count_ =0; } // end isEmpty /** @return true if new_entry was successfully added to items_, false otherwise **1 template bool ArrayBag> : add (const ItemType& new_entry) { bool has_room = (item_count_ < DEFAULT_CAPACITY); if (has_room) { items_[item_count_] = new_entry; item_count_++; return true; } // end if return false; } // end add /** @return true if an_entry was successfully removed from items_, false otherwise **/ template bool ArrayBag: : remove(const ItemType& an_entry) { int found_index = getIndex0f(an_entry); bool can_remove =! isEmpty () && (found_index >1 ); if (can_remove) { item_count_--; items_[found_index] = items_[item_count_] ; } // end if return can_remove; } // end remove /** @post item_count_ ==0 **1 template void ArrayBag: : clear() { #ifndef TAVERN_HPP_ #define TAVERN_HPP_ #include "ArrayBag.hpp" #include "Character.hpp" class Tavern : public ArrayBag>{ public: Tavern (); bool enterTavern(const Character& new_character); bool exitTavern(const Character& character_to_remove); int getLevelSum() const; double calculateAvgLevel() const; int getEnemyCount () const; double calculateEnemyPercentage() const; int tallyRace(const std: :string & race) const; void tavernReport() const; private: int level_sum_; int enemy_count_; } ; #endif #ifndef ARRAY_BAG_ #define ARRAY_BAG_ #include #include template class ArrayBag { public: /*** default constructor*w/ ArrayBag (); /** @return item_count_: the current size of the bag *ak/ int getCurrentSize() const; /*** greturn true if item_count_ ==0,
  • 8. false otherwise *ak/ bool isEmpty() const; /*** @return true if new_entry was successfully added to items_, false otherwise **k/ bool add(const ItemType &new_entry); / @return true if an_entry was successfully removed from items_, false otherwise / bool remove(const ItemType &an_entry); /** @post item_count_ ==0 **/ void clear(); /** @return true if an_entry is found in items_, false otherwise **/ bool contains (const ItemType &an_entry) const; /** @return the number of times an_entry is found in items_ *ok/ int getFrequency0f(const ItemType &an_entry) const; protected: static const int DEFAULT_CAPACITY =100; //max size of items_ at 100 by default for this project ItemType items_[DEFAULT_CAPACITY]; // Array of bag items int item_count_; // Current count of bag items /*** aparam target to be found in items_ @return either the index target in the array items_or -1 , if the array does not contain the target. / int getIndex0f(const ItemType ) const; }; // end ArrayBag #include "ArrayBag.cpp" #endif /** ereturn : the race of the Character (a string) */ std: :string getRace() const; / @param : an integer vitality epre : vitality >=0 : Characters cannot have negative health apost : sets the vitality private member to the value of the parameter */ void setVitality(const int& vitality); /*** @return : the value stored in vitality_ */ int getVitality() const; /*** @param : an integer armor level epre : armor >=0 : Characters cannot have negative armor epost : sets the armor private member to the value of the parameter */ void setArmor(const int& armor); /*** @return : the value stored in armor_ */ int getArmor() const; /*** @param : an integer level epre : level >=0 : Characters cannot have a negative apost : sets the level private member to the value of the parameter */ void setLevel(const int& level); /*** @return : the value stored in level_ */ int getLevel() const; /*** @post : sets the enemy flag to true */ void setEnemy(); /*** @return true if the character is an enemy, false otherwise Note: this is an accessor function and must follow the same convention as all acces */ bool isEnemy() const; #include "Tavern.hpp" #include #include Tavern: :Tavern () : level_sum_( 0 , enemy_count_( 0){} bool Tavern: : enterTavern(const Character& new_character) { bool result = add (new_character); if (result) { level_sum_ += new_character.getLevel( ); if (new_character.isEnemy()) { enemy_count_++; } } return result; } bool Tavern: :exitTavern(const Character& character_to_remove) { bool result = remove ( character_to_remove ); if (result) { level_sum_-= character_to_remove.getLevel(); if (character_to_remove.isEnemy()) { enemy_count_--; } } return result; } int Tavern: : getLevelSum() const { return level_sum_; } double Tavern: : calculateAvgLevel() const { return static_cast( level_sum_) / getCurrentSize(); } int Tavern: :getEnemyCount () const { return enemy_count_; }
  • 9. double Tavern: calculateEnemyPercentage() const { return static_cast(enemy_count_) / getCurrentSize() * 100.0; } int Tavern: : tallyRace(const std: :string& race) const { int count =0; for (int i=0; i< item_count_; i++) { if (items_[i].getRace ()== race) { count++; } } return count; } void Tavern: : tavernReport() const { std: : cout "Humans: " < tallyRace ("HUMAN") < "nElves: " < tallyRace("ELF") < "nDwarves: " < tallyRace ("DWARF") < "nLizards: " < tallyRace("LIZARD") < "nUndead: " < tallyRace("UNDEAD") "nThe average level is: " < std: fixed std: setprecision(2) calculateAvgLevel() "n" std: : fixed std: : setprecision(2) calculateEnemyPercentage() "% are enemies. n"; } Task 2: Modify the ArrayBag class Define and implement the following additional public member functions: /** aparam: A const reference to another ArrayBag object apost: Combines the contents from both ArrayBag objects, EXCLUDING duplicates. Example: [1,2,3]+=[1,4] will produce [1,2,3,4] */ operator /= /** aparam: A const reference to another ArrayBag object apost: Combines the contents from both ArrayBag objects, including duplicates, adding items from the argument bag as long as there is space. Example: [1,2,3]+=[1,4] will produce [1,2,3,1,4] */ operator+= #ifndef ARRAY_BAG_ #define ARRAY_BAG_ template class ArrayBag { public: ArrayBag ( ); int getCurrentSize() const; bool isEmpty() const; bool add(const ItemType& new_entry); bool remove(const ItemType& an_entry); void clear(); bool contains (const ItemType& an_entry) const; int getFrequency0f(const ItemType& an_entry) const; ArrayBag < ItemType >& operator /= ( const ArrayBag < ItemType >& anotherBag); ArrayBag < ItemType >& operator += ( const ArrayBag < ItemType >& anotherBag) ; protected: static const int DEFAULT_CAPACITY = 100; ItemType items_[DEFAULT_CAPACITY] ; int item_count_; int getIndex0f(const ItemType& target) const; }; #include "ArrayBag.cpp" #endif template int ArrayBag: : getFrequency0f(const ItemType& an_entry) const { int frequency =0; for (int i=0; i< item_count_; i++){ if (items_[i] == an_entry) { frequency++; } } return frequency; } template ArrayBag>& ArrayBag> : : operator/=(const ArrayBag < ItemType >& anotherBag) { for (int i=0; i< anotherBag.item_count_ && item_count_ < DEFAULT_CAPACITY; i++ ) { if (!this contains (anotherBag.items_[i])) { this add (anotherBag.items_[i]); } } return *this; } template ArrayBag>& ArrayBag < ItemType > : : operator +=( const ArrayBag < ItemType >& anotherBag ){ for (int i=0; i< anotherBag.item_count_ && item_count_ < DEFAULT_CAPACITY; i++ ) { this add (anotherBag.items_[i]); } return *this; } template int ArrayBag> : getIndex0f(const ItemType& target) const { for (int i=0; i< item_count_; i++ ) { if (items_[i] == target) { |
  • 10. return i; } } return -1; } template> ArrayBag: :ArrayBag() : item_count_(0) {} template int ArrayBag: : getCurrentSize() const { return item_count_; } template bool ArrayBag: : isEmpty() const { return item_count_ ==0; } template bool ArrayBag: : add(const ItemType& new_entry) { bool has_room = item_count_ < DEFAULT_CAPACITY; if (has_room) { items_[item_count_] = new_entry; item_count_++; return true; } return false; } template bool ArrayBag: : remove(const ItemType& an_entry) { int found_index = getIndex0f(an_entry); bool can_remove = ! isEmpty () && (found_index >1 ); if (can_remove) { item_count_--; items_[found_index] = items_[item_count_]; } return can_remove; } template void ArrayBag=0; } template bool ArrayBag: : contains(const ItemType& an_entry) const return getIndex0f(an_entry) > -1 ; } #include enum Race { NONE, HUMAN, ELF, DWARF, LIZARD, UNDEAD }; class Character { public: Character(); Character(const std: :string& name, const std: :string& race, int vitality =0, int armor =0, int level =0, bool enemy = false); void setName(const std: : string& name); std: :string getName() const; void setRace(const std: : string& race); std: :string getRace() const; void setVitality(const int& vitality); int getVitality() const; void setArmor(const int& armor); int getArmor() const; void setLevel(const int& level); int getLevel() const; void setEnemy(); bool isEnemy() const; bool operator == (const Character & rhs) const; bool operator!=(const Character& rhs) const; void display() const; private: std: :string name_; Race race_; int vitality_; int armor_; int level_; bool enemy_; }; #endif // CHARACTER_HPP_ ndef CHARACTER_HPP_ fine CHARACTER_HPP_ clude clude > clude Race NONE, HUMAN, ELF, DWARF, LIZARD, UNDEAD Iss Character public: / Default constructor. Default-initializes all private members. Default character name: "NAMELESS". Booleans are default-initialized to False. Default enum value: NONE. Default Vitality, Max Armor, and Level: 0 . / Character(); / Parameterized constructor. eparam : The name of the character (a string in UPPERCASE) eparam : The race of the character (a string) eparam : The character's vitality (a non-negative integer), with default value 0 eparam : The character's max armor level (a non- negative integer), with default value 0 eparam : The character's level (a non-negative integer), with default value 0 eparam : A flag indicating whether the character is an enemy, with default value false apost : The private members are set to the values of the corresponding parameters. Hint: Notice the default arguments in the parameterized constructor. / Character(const std: :string & name, const std: :string & race, int vitality =0, int armor =0, int level =0, bool enemy = false);
  • 11. / eparam : the name of the Character @post : sets the Character's title to the value of the parameter, in UPPERCASE. Only alphabetical characters are allowed. */ void setName(const std: : string& name); /*** ereturn : the name of the Character */ std: :string getName() const; /*** @param : the race of the Character (a string) epost : sets the Character's race to the value of the parameter : If the given race was invalid, set race_ to NONE. */ void setRace(const std: :string& race); Define and implement the following additional public member functions: /** aparam : A const reference to the right hand side of the == operator. areturn: Returns true if the right hand side character is "equal", false otherwise. Two characters are equal if they have the same name, same race, same level and are either both an enemy or not. NOTE: By this definition, only the aforementioned subset of the character's attributes must be equal for two characters to be deemed "equal". Example: In order for character1 to be == to character2 we only need: - The same name - The same race - The same level - They must either be both an enemy or not */ operator== /** aparam ': A const reference to the right hand side of the != operator. areturn : Returns true if the right hand side character is NOT "equal" (!=), false otherwise. Two characters are NOT equal if any of their name, race or level are not equal, or if one is an enemy and the other is not. NOTE: By this definition, one or more of the aforementioned subset of the character's attributes only must be different for two characters to be deemed "NOT equal". */ operator != /** apost : displays Character data in the form: "[name_] is a Level [level_] [race_]. nVitality: [vitality_] nMax Armor: [armor_] n[ They are / They are not] an enemy. n" / display Task 3: Implement the Tavern class as a subclass of ArrayBag The Tavern is subclass of ArrayBag that stores Character objects Data Types The Tavern class must have the following private member variables: - An integer sum of the levels of all the characters currently in the tavern - An integer count of all the characters currently in the Tavern that are marked as enemies The Tavern class must have the following public member functions: Constructor /** Default constructor. */ Default-initializes all private members. /** Default constructor. Default-initializes all private members. */ Inique Methods /** aparam: A const reference to a Character entering the Tavern (areturn: returns true if a Character was successfully added to the tavern (i.e. items_), false otherwise apost: adds Character to the Tavern and updates the level sum and the enemy count if the character is an enemy. **/ enterTavern /** aparam: A const reference to a Character leaving the Tavern (areturn: returns true if a character was successfully removed from the tavern (i.e. items_), false otherwise apost: removes the character from the Tavern and updates the level sum
  • 12. and the enemy count if the character is an enemy. **/ exitTavern / areturn: The integer level count of all the characters currently in the Tavern **/ getLevelSum /** areturn: The average level of all the characters in the Tavern apost: Computes the average level of the Tavern rounded to the NEAREST integer. **/ calculateAvgLevel /** areturn: The integer enemy count of the Tavern **/ getEnemyCount /** areturn: The percentage (double) of all the enemy characters in the Tavern apost: Computes the enemy percentage of the Tavern rounded up to 2 decimal places. **/ calculateEnemyPercentage / aparam: A const reference to a string representing a character Race with value in ["NONE", "HUMAN", "ElF", "DWARF", "LIZARD", "UNDEAD"] (areturn: An integer tally of the number of characters in the Tavern of the given race. If the argument string does not match one of the expected race values, the tally is zero. NOTE: no pre-processing of the input string necessary, only uppercase input will match. **/ tallyRace / @post: Outputs a report of the characters currently in the tavern in the form: "Humans: [x] nElves: [x] nDwarves: [x] nLizards: [x] nUndead: [x] nnThe average level is: [x]n[x]% are enemies. n" Note that the average level should be rounded to the NEAREST integer, and the enemy percentage should be rounded to 2 decimal places. Example output: Humans: 3 Elves: 5 Dwarves: 8 Lizards: 6 Undead: 0 The average level is: 7 46.67% are enemies. */ tavernReport #include "Character.hpp" #include #include Character::Character() : name_("NAMELESS"), race_(NONE), vitality_(0), armor_(0), level_( 0), enemy_(false) {} Character: :Character(const std::string& name, const std: :string& race, int vitality, int armor, int level, bool enemy) : Character() { setName (name); setRace (race); (vitality >=0 ) ? vitality = vitality : vitality =0; (armor >=0 ) ? armor = armor : armor =0; (level >=0) ? level_ = level : level_ =0; enemy_ = enemy; } void Character: : setName (const std: :string& name) { std: : string nameUpper = ""; for(char c : name) { if (std: : isalpha(c)) { nameUpper += std: : toupper (c); } } name_ = nameUpper.empty () ? "NAMELESS" : nameUpper; } std: :string Character: :getName() const { return name_; } void Character: : setRace (const std: :string& race) { if ( race == "HUMAN") race =HUMAN; else if ( race == "ELF") race_ = ELF; else if ( race == "DWARF") race =DWARF; else if ( race == "LIZARD") race =LIZARD; else if ( race == "UNDEAD") race =UNDEAD; else race =NONE; } std: :string Character: :getRace() const { switch (race_) { case HUMAN: return "HUMAN"; case ELF: return "ELF"; case DWARF: return "DWARF"; case LIZARD: return "LIZARD"; case UNDEAD: return "UNDEAD"; default: return "NONE"; } } void Character: setVitality(const int& vitality) { /** ereturn : the race of the Character (a string) */ std: :string getRace() const; / @param : an integer vitality epre : vitality >=0 : Characters cannot have negative health apost : sets the vitality private member to the value of the parameter */ void setVitality(const int& vitality); /***
  • 13. @return : the value stored in vitality_ */ int getVitality() const; /*** @param : an integer armor level epre : armor >=0 : Characters cannot have negative armor epost : sets the armor private member to the value of the parameter */ void setArmor(const int& armor); /*** @return : the value stored in armor_ */ int getArmor() const; /*** @param : an integer level epre : level >=0 : Characters cannot have a negative apost : sets the level private member to the value of the parameter */ void setLevel(const int& level); /*** @return : the value stored in level_ */ int getLevel() const; /*** @post : sets the enemy flag to true */ void setEnemy(); /*** @return true if the character is an enemy, false otherwise Note: this is an accessor function and must follow the same convention as all acces */ bool isEnemy() const;