SlideShare a Scribd company logo
1 of 8
Download to read offline
Could someone help with this code
#include "Armour.h"
//------------------------------------------------------------------------------
Armour::Armour()
:Item("Armour", false), // There should be something simliar in Consumable.cpp
material(),
modifier()
{
this->durability = 0;
this->defense = 0;
this->modifierLevel = 1;
}
//------------------------------------------------------------------------------
void Armour::display(std::ostream& outs) const
{
// Implement this function
}
//------------------------------------------------------------------------------
void Armour::read(std::istream& ins)
{
// Implement this function
}
//------------------------------------------------------------------------------
Item* Armour::clone() const
{
// Implement this function
return nullptr; // remove this line
}
//Consumable.cpp
#include "Consumable.h"
//------------------------------------------------------------------------------
Consumable::Consumable()
{
}
//------------------------------------------------------------------------------
//void Consumable::display(std::ostream& outs) const
// Add the definition for this function
//------------------------------------------------------------------------------
// void Consumable::read(std::istream& ins)
// Add the definition for this function
//------------------------------------------------------------------------------
// Item* Consumable::clone() const
// Add the definition for this function
//Consumable.h
#ifndef CONSUMABLE_H_INCLUDED
#define CONSUMABLE_H_INCLUDED
#include "Item.h"
/**
* This class represents one Consumable Item--as found in most video games.
* This includes food.
*
* Consumable Items must be stackable. All Constructors must initialize
* Item::stackable to true.
*/
class Consumable : public Item {
private:
protected:
/**
* The effect recieved by using the Item.
*/
std::string effect;
/**
* Number of time this Item can be used.
*/
int uses;
public:
/**
* Default to a Comsumable Item with an empty name
*/
Consumable();
// Big-3
Consumable(const Consumable& src) = default;
~Consumable() = default;
Consumable& operator=(Consumable& rhs) = default;
/**
* Retrieve effect
*/
std::string getEffect() const;
/**
* Set effect
*/
void setEffect(std::string effect);
/**
* Retrieve number of uses
*/
int getNumberOfUses() const;
/**
* Set number of uses
*/
void setNumberOfUses(int u);
/**
* Print the Consumable Item
*/
virtual void display(std::ostream& outs) const;
/**
* Read Consumable Item attributes from an input stream
*/
virtual void read(std::istream& ins);
/**
* Clone--i.e., copy--this Consumable Item
*/
virtual Item* clone() const;
};
//------------------------------------------------------------------------------
inline
std::string Consumable::getEffect() const
{
return this->effect;
}
//------------------------------------------------------------------------------
inline
void Consumable::setEffect(std::string effect)
{
this->effect = effect;
}
//------------------------------------------------------------------------------
inline
int Consumable::getNumberOfUses() const
{
return this->uses;
}
//------------------------------------------------------------------------------
inline
void Consumable::setNumberOfUses(int u)
{
this->uses = u;
}
#endif
//Armour.h
#ifndef ARMOUR_H_INCLUDED
#define ARMOUR_H_INCLUDED
#include "Item.h"
/**
* This class represents one piece of armour--as found in most video games.
* This includes boots and helmets.
*
* Armour may not be stacked. All Constructors must initialize Item::stackable
* to false.
*/
class Armour : public Item {
private:
protected:
double durability; ///< decreases each time the armour is used
double defense; ///< damage that is blocked
std::string material; ///< material out of which the armour is composed
std::string modifier; ///< one of protection, feather_falling, or unbreaking
int modifierLevel; ///< modifier level in the range 1 to 3
std::string element; ///< associated element--e.g., ice, fire, and lightning.
public:
/**
* Default to a armour with an empty name
*/
Armour();
// Big-3
Armour(const Armour& src) = default;
~Armour() = default;
Armour& operator=(const Armour& rhs) = default;
/**
* Retrieve armour durability
*/
double getDurability() const;
/**
* Set armour durability
*/
void setDurability(double durability);
/**
* Retrieve armour defense
*/
double getDefense() const;
/**
* Set armour defense
*/
void setDefense(double defense);
/**
* Retrieve armour Material
*/
std::string getMaterial() const;
/**
* Set armour Material
*/
void setMaterial(std::string m);
/**
* Retrieve armour Modifier
*/
std::string getModifier() const;
/**
* Set armour Modifier
*/
void setModifier(std::string m);
/**
* Retrieve armour Modifier Level
*/
double getModifierLevel() const;
/**
* Set armour Modifier Level
*/
void setModifierLevel(double level);
/**
* Retrieve armour Element
*/
std::string getElement() const;
/**
* Set armour Element
*/
void setElement(std::string e);
/**
* Print one Armour
*/
virtual void display(std::ostream& outs) const;
/**
* Read Armour attributes from an input stream
*/
virtual void read(std::istream& ins);
/**
* Clone--i.e., copy--this Armour
*/
virtual Item* clone() const;
};
//------------------------------------------------------------------------------
inline
double Armour::getDurability() const
{
return this->durability;
}
//------------------------------------------------------------------------------
inline
void Armour::setDurability(double durability)
{
this->durability = durability;
}
//------------------------------------------------------------------------------
inline
double Armour::getDefense() const
{
return this->defense;
}
//------------------------------------------------------------------------------
inline
void Armour::setDefense(double defense)
{
this->defense = defense;
}
//------------------------------------------------------------------------------
inline
std::string Armour::getMaterial() const
{
return this->material;
}
//------------------------------------------------------------------------------
inline
void Armour::setMaterial(std::string m)
{
this->material = m;
}
//------------------------------------------------------------------------------
inline
std::string Armour::getModifier() const
{
return this->modifier;
}
//------------------------------------------------------------------------------
inline
void Armour::setModifier(std::string m)
{
this->modifier = m;
}
//------------------------------------------------------------------------------
inline
double Armour::getModifierLevel() const
{
return this->modifierLevel;
}
//------------------------------------------------------------------------------
inline
void Armour::setModifierLevel(double level)
{
this->modifierLevel = level;
}
//------------------------------------------------------------------------------
inline
std::string Armour::getElement() const
{
return this->element;
}
//------------------------------------------------------------------------------
inline
void Armour::setElement(std::string e)
{
this->element = e;
}
#endif
Only Armour.cpp and Consumable.cpp need to be changed
1.3 Your Tasks The key abstractions employed in this program are Item, Itemstack, Inventory
Armour, and Consumable. Your overall task is to complete the Armour and Consumable ADTs. 1.
As an initial step, you will need to complete the Armour and Consumable Default Constructors: A.
Set the stackable attribute-i.e., stackable. Hint Remember initializer lists? B. Set the name
attribute-i.e., Item: : name. The attribute, name, is a protected data member of Item. 2. Implement
Armour: :clone and Consumable:: clone. 3. Implement Armour: : read and Consumable: : read. 4.
Implement Armour: : display and Consumable : : display. You are expected to generate additional
input files to test your code. Test your code throughly before submitting y 1.3.1 Expected Initial
Error Messages If you run make without adding the missing read, clone, and display methods, you
will see something simliar to /usr/bin/ld.gold: the vtable symbol may be undefined because the
class is missing its key function Armour. cpp:14: error: undefined reference to 'vtable for Armour'
/usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function
Consumable.cpp:4: error: undefined reference to 'vtable for Consumable' /usr/bin/ld.gold: the
vtable symbol may be undefined because the class is missing its key function
Consumable.cpp:12: error: undefined reference to 'vtable for Consumable' /usr/bin/ld.gold: the
vtable symbol may be undefined because the class is missing its key function collect2: error: ld
returned 1 exit status make: *** [storage] Error 11.3.2 Testing Your Code I have provided you a set
of unit tests. In addition to your normal checks (e.g., running the completed program and
performing headto-head testing) run the unit tests with make tests ./ testNewClasses You should
see: PASSED testDefaultArmourConstructor PASSED - testArmourCopyConstructor PASSED
testArmourClone PASSED testArmourDisplay PASSED testArmourRead PASSED
testDefaultConsumableConstructor PASSED testConsumableCopyConstructor PASSED
testConsumableClone PASSED - testConsumableDisplay PASSED testConsumableRead

More Related Content

Similar to Could someone help with this code include Armourh .pdf

Azure arm template ia c security
Azure arm template ia c securityAzure arm template ia c security
Azure arm template ia c securityPrancer Io
 
Advance C++notes
Advance C++notesAdvance C++notes
Advance C++notesRajiv Gupta
 
20090814102834_嵌入式C与C++语言精华文章集锦.docx
20090814102834_嵌入式C与C++语言精华文章集锦.docx20090814102834_嵌入式C与C++语言精华文章集锦.docx
20090814102834_嵌入式C与C++语言精华文章集锦.docxMostafaParvin1
 
Does your configuration code smell?
Does your configuration code smell?Does your configuration code smell?
Does your configuration code smell?Tushar Sharma
 
Strategy and best practice for modern RPG
Strategy and best practice for modern RPGStrategy and best practice for modern RPG
Strategy and best practice for modern RPGAlemanalfredo
 
Lab11.cppLab11.cpp.docx
Lab11.cppLab11.cpp.docxLab11.cppLab11.cpp.docx
Lab11.cppLab11.cpp.docxDIPESH30
 
Docker container management
Docker container managementDocker container management
Docker container managementKarol Kreft
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modulesHao-Ran Liu
 
Migrating Legacy Rails Apps to Rails 3
Migrating Legacy Rails Apps to Rails 3Migrating Legacy Rails Apps to Rails 3
Migrating Legacy Rails Apps to Rails 3Clinton Dreisbach
 
Linux Porting
Linux PortingLinux Porting
Linux PortingChamp Yen
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelDivye Kapoor
 
Design of bare metal proxy compute node
Design of bare metal proxy compute nodeDesign of bare metal proxy compute node
Design of bare metal proxy compute nodeLorin Hochstein
 
Can anyone fix this code, I use Visual StudiosThe Errors im getti.pdf
Can anyone fix this code, I use Visual StudiosThe Errors im getti.pdfCan anyone fix this code, I use Visual StudiosThe Errors im getti.pdf
Can anyone fix this code, I use Visual StudiosThe Errors im getti.pdfarjunhassan8
 
learn Helm 3 for kuberenetes
learn Helm 3 for kubereneteslearn Helm 3 for kuberenetes
learn Helm 3 for kuberenetesShyam Mohan
 

Similar to Could someone help with this code include Armourh .pdf (20)

Azure arm template ia c security
Azure arm template ia c securityAzure arm template ia c security
Azure arm template ia c security
 
Advance C++notes
Advance C++notesAdvance C++notes
Advance C++notes
 
20090814102834_嵌入式C与C++语言精华文章集锦.docx
20090814102834_嵌入式C与C++语言精华文章集锦.docx20090814102834_嵌入式C与C++语言精华文章集锦.docx
20090814102834_嵌入式C与C++语言精华文章集锦.docx
 
Ass hđh
Ass hđhAss hđh
Ass hđh
 
Ass OS
Ass OSAss OS
Ass OS
 
Does your configuration code smell?
Does your configuration code smell?Does your configuration code smell?
Does your configuration code smell?
 
The_Borrow_Checker.pdf
The_Borrow_Checker.pdfThe_Borrow_Checker.pdf
The_Borrow_Checker.pdf
 
Strategy and best practice for modern RPG
Strategy and best practice for modern RPGStrategy and best practice for modern RPG
Strategy and best practice for modern RPG
 
Lab11.cppLab11.cpp.docx
Lab11.cppLab11.cpp.docxLab11.cppLab11.cpp.docx
Lab11.cppLab11.cpp.docx
 
Docker container management
Docker container managementDocker container management
Docker container management
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
 
Migrating Legacy Rails Apps to Rails 3
Migrating Legacy Rails Apps to Rails 3Migrating Legacy Rails Apps to Rails 3
Migrating Legacy Rails Apps to Rails 3
 
Linux Porting
Linux PortingLinux Porting
Linux Porting
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
 
Design of bare metal proxy compute node
Design of bare metal proxy compute nodeDesign of bare metal proxy compute node
Design of bare metal proxy compute node
 
Can anyone fix this code, I use Visual StudiosThe Errors im getti.pdf
Can anyone fix this code, I use Visual StudiosThe Errors im getti.pdfCan anyone fix this code, I use Visual StudiosThe Errors im getti.pdf
Can anyone fix this code, I use Visual StudiosThe Errors im getti.pdf
 
Readme
ReadmeReadme
Readme
 
Memory management in c++
Memory management in c++Memory management in c++
Memory management in c++
 
C++ Core Guidelines
C++ Core GuidelinesC++ Core Guidelines
C++ Core Guidelines
 
learn Helm 3 for kuberenetes
learn Helm 3 for kubereneteslearn Helm 3 for kuberenetes
learn Helm 3 for kuberenetes
 

More from devangmittal4

Continuous bag of words cbow word2vec word embedding work .pdf
Continuous bag of words cbow word2vec word embedding work .pdfContinuous bag of words cbow word2vec word embedding work .pdf
Continuous bag of words cbow word2vec word embedding work .pdfdevangmittal4
 
Continuous variable X is uniformly distributed the interval .pdf
Continuous variable X is uniformly distributed the interval .pdfContinuous variable X is uniformly distributed the interval .pdf
Continuous variable X is uniformly distributed the interval .pdfdevangmittal4
 
Construct a diversity matrix table and cladogram that compar.pdf
Construct a diversity matrix table and cladogram that compar.pdfConstruct a diversity matrix table and cladogram that compar.pdf
Construct a diversity matrix table and cladogram that compar.pdfdevangmittal4
 
Containerization has revolutionized shipping Use the infor.pdf
Containerization has revolutionized shipping  Use the infor.pdfContainerization has revolutionized shipping  Use the infor.pdf
Containerization has revolutionized shipping Use the infor.pdfdevangmittal4
 
Create a class for a course called hasa This class will hav.pdf
Create a class for a course called hasa This class will hav.pdfCreate a class for a course called hasa This class will hav.pdf
Create a class for a course called hasa This class will hav.pdfdevangmittal4
 
Create a C program which performs the addition of two comple.pdf
Create a C program which performs the addition of two comple.pdfCreate a C program which performs the addition of two comple.pdf
Create a C program which performs the addition of two comple.pdfdevangmittal4
 
Create a 6 to 8slide Microsoft PowerPoint presentation .pdf
Create a 6 to 8slide Microsoft PowerPoint presentation .pdfCreate a 6 to 8slide Microsoft PowerPoint presentation .pdf
Create a 6 to 8slide Microsoft PowerPoint presentation .pdfdevangmittal4
 
Create a 12 to 14slide presentation with detailed speaker .pdf
Create a 12 to 14slide presentation with detailed speaker .pdfCreate a 12 to 14slide presentation with detailed speaker .pdf
Create a 12 to 14slide presentation with detailed speaker .pdfdevangmittal4
 
CRANdan dslabs paketini kurun ardndan library komutuyla .pdf
CRANdan dslabs paketini kurun ardndan library komutuyla .pdfCRANdan dslabs paketini kurun ardndan library komutuyla .pdf
CRANdan dslabs paketini kurun ardndan library komutuyla .pdfdevangmittal4
 
Craft a script in a file named plusQ1 that prompts the us.pdf
Craft a script in a file named plusQ1 that  prompts the us.pdfCraft a script in a file named plusQ1 that  prompts the us.pdf
Craft a script in a file named plusQ1 that prompts the us.pdfdevangmittal4
 
Crane Company had a beginning inventory of 100 units of Prod.pdf
Crane Company had a beginning inventory of 100 units of Prod.pdfCrane Company had a beginning inventory of 100 units of Prod.pdf
Crane Company had a beginning inventory of 100 units of Prod.pdfdevangmittal4
 
Coursera learning python interacting with operating system .pdf
Coursera learning python interacting with operating system .pdfCoursera learning python interacting with operating system .pdf
Coursera learning python interacting with operating system .pdfdevangmittal4
 
Crane Company manufactures pizza sauce through two productio.pdf
Crane Company manufactures pizza sauce through two productio.pdfCrane Company manufactures pizza sauce through two productio.pdf
Crane Company manufactures pizza sauce through two productio.pdfdevangmittal4
 
CPP Introduction types of benefits eligibility of benefit.pdf
CPP Introduction types of benefits eligibility of benefit.pdfCPP Introduction types of benefits eligibility of benefit.pdf
CPP Introduction types of benefits eligibility of benefit.pdfdevangmittal4
 
COVID19 is going to change the way fast food restaurants pr.pdf
COVID19 is going to change the way fast food restaurants pr.pdfCOVID19 is going to change the way fast food restaurants pr.pdf
COVID19 is going to change the way fast food restaurants pr.pdfdevangmittal4
 
Course Organization Modeling for DT 11 The Ecosystem map .pdf
Course Organization Modeling for DT 11 The Ecosystem map .pdfCourse Organization Modeling for DT 11 The Ecosystem map .pdf
Course Organization Modeling for DT 11 The Ecosystem map .pdfdevangmittal4
 
cowan Company currently pays a 300 dividend The Board has.pdf
cowan Company currently pays a 300 dividend The Board has.pdfcowan Company currently pays a 300 dividend The Board has.pdf
cowan Company currently pays a 300 dividend The Board has.pdfdevangmittal4
 
country is Ethiopia Use the UNCTAD STAT Country Profile site.pdf
country is Ethiopia Use the UNCTAD STAT Country Profile site.pdfcountry is Ethiopia Use the UNCTAD STAT Country Profile site.pdf
country is Ethiopia Use the UNCTAD STAT Country Profile site.pdfdevangmittal4
 
Course Participation Strategies to Compete in the Markets .pdf
Course Participation  Strategies to Compete in the Markets .pdfCourse Participation  Strategies to Compete in the Markets .pdf
Course Participation Strategies to Compete in the Markets .pdfdevangmittal4
 
Course ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdf
Course ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdfCourse ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdf
Course ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdfdevangmittal4
 

More from devangmittal4 (20)

Continuous bag of words cbow word2vec word embedding work .pdf
Continuous bag of words cbow word2vec word embedding work .pdfContinuous bag of words cbow word2vec word embedding work .pdf
Continuous bag of words cbow word2vec word embedding work .pdf
 
Continuous variable X is uniformly distributed the interval .pdf
Continuous variable X is uniformly distributed the interval .pdfContinuous variable X is uniformly distributed the interval .pdf
Continuous variable X is uniformly distributed the interval .pdf
 
Construct a diversity matrix table and cladogram that compar.pdf
Construct a diversity matrix table and cladogram that compar.pdfConstruct a diversity matrix table and cladogram that compar.pdf
Construct a diversity matrix table and cladogram that compar.pdf
 
Containerization has revolutionized shipping Use the infor.pdf
Containerization has revolutionized shipping  Use the infor.pdfContainerization has revolutionized shipping  Use the infor.pdf
Containerization has revolutionized shipping Use the infor.pdf
 
Create a class for a course called hasa This class will hav.pdf
Create a class for a course called hasa This class will hav.pdfCreate a class for a course called hasa This class will hav.pdf
Create a class for a course called hasa This class will hav.pdf
 
Create a C program which performs the addition of two comple.pdf
Create a C program which performs the addition of two comple.pdfCreate a C program which performs the addition of two comple.pdf
Create a C program which performs the addition of two comple.pdf
 
Create a 6 to 8slide Microsoft PowerPoint presentation .pdf
Create a 6 to 8slide Microsoft PowerPoint presentation .pdfCreate a 6 to 8slide Microsoft PowerPoint presentation .pdf
Create a 6 to 8slide Microsoft PowerPoint presentation .pdf
 
Create a 12 to 14slide presentation with detailed speaker .pdf
Create a 12 to 14slide presentation with detailed speaker .pdfCreate a 12 to 14slide presentation with detailed speaker .pdf
Create a 12 to 14slide presentation with detailed speaker .pdf
 
CRANdan dslabs paketini kurun ardndan library komutuyla .pdf
CRANdan dslabs paketini kurun ardndan library komutuyla .pdfCRANdan dslabs paketini kurun ardndan library komutuyla .pdf
CRANdan dslabs paketini kurun ardndan library komutuyla .pdf
 
Craft a script in a file named plusQ1 that prompts the us.pdf
Craft a script in a file named plusQ1 that  prompts the us.pdfCraft a script in a file named plusQ1 that  prompts the us.pdf
Craft a script in a file named plusQ1 that prompts the us.pdf
 
Crane Company had a beginning inventory of 100 units of Prod.pdf
Crane Company had a beginning inventory of 100 units of Prod.pdfCrane Company had a beginning inventory of 100 units of Prod.pdf
Crane Company had a beginning inventory of 100 units of Prod.pdf
 
Coursera learning python interacting with operating system .pdf
Coursera learning python interacting with operating system .pdfCoursera learning python interacting with operating system .pdf
Coursera learning python interacting with operating system .pdf
 
Crane Company manufactures pizza sauce through two productio.pdf
Crane Company manufactures pizza sauce through two productio.pdfCrane Company manufactures pizza sauce through two productio.pdf
Crane Company manufactures pizza sauce through two productio.pdf
 
CPP Introduction types of benefits eligibility of benefit.pdf
CPP Introduction types of benefits eligibility of benefit.pdfCPP Introduction types of benefits eligibility of benefit.pdf
CPP Introduction types of benefits eligibility of benefit.pdf
 
COVID19 is going to change the way fast food restaurants pr.pdf
COVID19 is going to change the way fast food restaurants pr.pdfCOVID19 is going to change the way fast food restaurants pr.pdf
COVID19 is going to change the way fast food restaurants pr.pdf
 
Course Organization Modeling for DT 11 The Ecosystem map .pdf
Course Organization Modeling for DT 11 The Ecosystem map .pdfCourse Organization Modeling for DT 11 The Ecosystem map .pdf
Course Organization Modeling for DT 11 The Ecosystem map .pdf
 
cowan Company currently pays a 300 dividend The Board has.pdf
cowan Company currently pays a 300 dividend The Board has.pdfcowan Company currently pays a 300 dividend The Board has.pdf
cowan Company currently pays a 300 dividend The Board has.pdf
 
country is Ethiopia Use the UNCTAD STAT Country Profile site.pdf
country is Ethiopia Use the UNCTAD STAT Country Profile site.pdfcountry is Ethiopia Use the UNCTAD STAT Country Profile site.pdf
country is Ethiopia Use the UNCTAD STAT Country Profile site.pdf
 
Course Participation Strategies to Compete in the Markets .pdf
Course Participation  Strategies to Compete in the Markets .pdfCourse Participation  Strategies to Compete in the Markets .pdf
Course Participation Strategies to Compete in the Markets .pdf
 
Course ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdf
Course ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdfCourse ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdf
Course ELECTRONIC HEALTH RECORDS Feild of Study INFORMATI.pdf
 

Recently uploaded

Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
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
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answersdalebeck957
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactisticshameyhk98
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
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
 

Recently uploaded (20)

Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
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
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
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
 

Could someone help with this code include Armourh .pdf

  • 1. Could someone help with this code #include "Armour.h" //------------------------------------------------------------------------------ Armour::Armour() :Item("Armour", false), // There should be something simliar in Consumable.cpp material(), modifier() { this->durability = 0; this->defense = 0; this->modifierLevel = 1; } //------------------------------------------------------------------------------ void Armour::display(std::ostream& outs) const { // Implement this function } //------------------------------------------------------------------------------ void Armour::read(std::istream& ins) { // Implement this function } //------------------------------------------------------------------------------ Item* Armour::clone() const { // Implement this function return nullptr; // remove this line } //Consumable.cpp #include "Consumable.h" //------------------------------------------------------------------------------ Consumable::Consumable() { } //------------------------------------------------------------------------------ //void Consumable::display(std::ostream& outs) const // Add the definition for this function //------------------------------------------------------------------------------ // void Consumable::read(std::istream& ins) // Add the definition for this function //------------------------------------------------------------------------------ // Item* Consumable::clone() const
  • 2. // Add the definition for this function //Consumable.h #ifndef CONSUMABLE_H_INCLUDED #define CONSUMABLE_H_INCLUDED #include "Item.h" /** * This class represents one Consumable Item--as found in most video games. * This includes food. * * Consumable Items must be stackable. All Constructors must initialize * Item::stackable to true. */ class Consumable : public Item { private: protected: /** * The effect recieved by using the Item. */ std::string effect; /** * Number of time this Item can be used. */ int uses; public: /** * Default to a Comsumable Item with an empty name */ Consumable(); // Big-3 Consumable(const Consumable& src) = default; ~Consumable() = default; Consumable& operator=(Consumable& rhs) = default; /** * Retrieve effect */ std::string getEffect() const; /** * Set effect */ void setEffect(std::string effect); /** * Retrieve number of uses
  • 3. */ int getNumberOfUses() const; /** * Set number of uses */ void setNumberOfUses(int u); /** * Print the Consumable Item */ virtual void display(std::ostream& outs) const; /** * Read Consumable Item attributes from an input stream */ virtual void read(std::istream& ins); /** * Clone--i.e., copy--this Consumable Item */ virtual Item* clone() const; }; //------------------------------------------------------------------------------ inline std::string Consumable::getEffect() const { return this->effect; } //------------------------------------------------------------------------------ inline void Consumable::setEffect(std::string effect) { this->effect = effect; } //------------------------------------------------------------------------------ inline int Consumable::getNumberOfUses() const { return this->uses; } //------------------------------------------------------------------------------ inline void Consumable::setNumberOfUses(int u) { this->uses = u;
  • 4. } #endif //Armour.h #ifndef ARMOUR_H_INCLUDED #define ARMOUR_H_INCLUDED #include "Item.h" /** * This class represents one piece of armour--as found in most video games. * This includes boots and helmets. * * Armour may not be stacked. All Constructors must initialize Item::stackable * to false. */ class Armour : public Item { private: protected: double durability; ///< decreases each time the armour is used double defense; ///< damage that is blocked std::string material; ///< material out of which the armour is composed std::string modifier; ///< one of protection, feather_falling, or unbreaking int modifierLevel; ///< modifier level in the range 1 to 3 std::string element; ///< associated element--e.g., ice, fire, and lightning. public: /** * Default to a armour with an empty name */ Armour(); // Big-3 Armour(const Armour& src) = default; ~Armour() = default; Armour& operator=(const Armour& rhs) = default; /** * Retrieve armour durability */ double getDurability() const; /** * Set armour durability */ void setDurability(double durability); /** * Retrieve armour defense */
  • 5. double getDefense() const; /** * Set armour defense */ void setDefense(double defense); /** * Retrieve armour Material */ std::string getMaterial() const; /** * Set armour Material */ void setMaterial(std::string m); /** * Retrieve armour Modifier */ std::string getModifier() const; /** * Set armour Modifier */ void setModifier(std::string m); /** * Retrieve armour Modifier Level */ double getModifierLevel() const; /** * Set armour Modifier Level */ void setModifierLevel(double level); /** * Retrieve armour Element */ std::string getElement() const; /** * Set armour Element */ void setElement(std::string e); /** * Print one Armour */ virtual void display(std::ostream& outs) const; /**
  • 6. * Read Armour attributes from an input stream */ virtual void read(std::istream& ins); /** * Clone--i.e., copy--this Armour */ virtual Item* clone() const; }; //------------------------------------------------------------------------------ inline double Armour::getDurability() const { return this->durability; } //------------------------------------------------------------------------------ inline void Armour::setDurability(double durability) { this->durability = durability; } //------------------------------------------------------------------------------ inline double Armour::getDefense() const { return this->defense; } //------------------------------------------------------------------------------ inline void Armour::setDefense(double defense) { this->defense = defense; } //------------------------------------------------------------------------------ inline std::string Armour::getMaterial() const { return this->material; } //------------------------------------------------------------------------------ inline void Armour::setMaterial(std::string m) {
  • 7. this->material = m; } //------------------------------------------------------------------------------ inline std::string Armour::getModifier() const { return this->modifier; } //------------------------------------------------------------------------------ inline void Armour::setModifier(std::string m) { this->modifier = m; } //------------------------------------------------------------------------------ inline double Armour::getModifierLevel() const { return this->modifierLevel; } //------------------------------------------------------------------------------ inline void Armour::setModifierLevel(double level) { this->modifierLevel = level; } //------------------------------------------------------------------------------ inline std::string Armour::getElement() const { return this->element; } //------------------------------------------------------------------------------ inline void Armour::setElement(std::string e) { this->element = e; } #endif Only Armour.cpp and Consumable.cpp need to be changed 1.3 Your Tasks The key abstractions employed in this program are Item, Itemstack, Inventory Armour, and Consumable. Your overall task is to complete the Armour and Consumable ADTs. 1.
  • 8. As an initial step, you will need to complete the Armour and Consumable Default Constructors: A. Set the stackable attribute-i.e., stackable. Hint Remember initializer lists? B. Set the name attribute-i.e., Item: : name. The attribute, name, is a protected data member of Item. 2. Implement Armour: :clone and Consumable:: clone. 3. Implement Armour: : read and Consumable: : read. 4. Implement Armour: : display and Consumable : : display. You are expected to generate additional input files to test your code. Test your code throughly before submitting y 1.3.1 Expected Initial Error Messages If you run make without adding the missing read, clone, and display methods, you will see something simliar to /usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function Armour. cpp:14: error: undefined reference to 'vtable for Armour' /usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function Consumable.cpp:4: error: undefined reference to 'vtable for Consumable' /usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function Consumable.cpp:12: error: undefined reference to 'vtable for Consumable' /usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function collect2: error: ld returned 1 exit status make: *** [storage] Error 11.3.2 Testing Your Code I have provided you a set of unit tests. In addition to your normal checks (e.g., running the completed program and performing headto-head testing) run the unit tests with make tests ./ testNewClasses You should see: PASSED testDefaultArmourConstructor PASSED - testArmourCopyConstructor PASSED testArmourClone PASSED testArmourDisplay PASSED testArmourRead PASSED testDefaultConsumableConstructor PASSED testConsumableCopyConstructor PASSED testConsumableClone PASSED - testConsumableDisplay PASSED testConsumableRead