SlideShare a Scribd company logo
1 of 2
Download to read offline
Submit only one file.
sample run:
Human attacks for 12 points!
Elf attacks for 4 points!
Balrog attacks for 27 points!
Balrog speed attack inflicts 49 additional damage points!
Cyberdemon attacks for 2 points!
Elf attacks for 42 points!
Creature 2 has 8 hit points.
Balrog attacks for 19 points!
Balrog speed attack inflicts 41 additional damage points!
Creature 1 has -10 hit points.
Creature 2 wins!
Press any key to continue . . .
Please follow the instructions and make the same output as the sample run above. Moreover, do
proper indentations and submit only one file. (compose coding in one) (Please combine codings
in one file) Suppose that you are creating a game. In this game we have four different types of
creatures: humans, cyberdemons, balrogs, and elves. To represent one of these creatures we
might define a Creature class as follows: class Creature ( private: int type; // 0 human, 1
cyberdemon, 2 balrog, 3 elf int strength; // How much damage we can inflict int hitpoints; // How
much damage we can sustain string getspecies (); // Returns type of species, for creature class //
returns "unKnown" public: Creature( ); // Initialize to human, 10 strength, 10 hit points
Creature(int newType, int newstrength, int newHit); // Initialize creature to new type, strength,
hit points // Also add appropriate accessor and mutator functions // for type, strength, and hit
points int getdamage (); // Returns amount of damage this creature // inflicts in one round of
combat Here is an initial implementation of the getspecies ( ) function: string
Creature::getspecies () { switch (type) { case 0: return "Human"; case 1: return "Cyberdemon";
case 2: return "Balrog"; case 3: return "Elf"; } return "Unknown"; The getDamage ( ) function
outputs and returns the damage this creature can inflict in one round of combat. The rules for
calculating the damage are as follows: - Every creature inflicts damage that is a random number
r, where 0

More Related Content

More from ayubkota

Suponga que ha sido contratado como encargado de compras de un nuevo.pdf
Suponga que ha sido contratado como encargado de compras de un nuevo.pdfSuponga que ha sido contratado como encargado de compras de un nuevo.pdf
Suponga que ha sido contratado como encargado de compras de un nuevo.pdfayubkota
 
Supervalu, one of the largest retailers in the united states, is hea.pdf
Supervalu, one of the largest retailers in the united states, is hea.pdfSupervalu, one of the largest retailers in the united states, is hea.pdf
Supervalu, one of the largest retailers in the united states, is hea.pdfayubkota
 
Sunny Corporation has collected the following data for one of its pr.pdf
Sunny Corporation has collected the following data for one of its pr.pdfSunny Corporation has collected the following data for one of its pr.pdf
Sunny Corporation has collected the following data for one of its pr.pdfayubkota
 
Sue had bronchitis and had to go to the hospital. The episode cost h.pdf
Sue had bronchitis and had to go to the hospital. The episode cost h.pdfSue had bronchitis and had to go to the hospital. The episode cost h.pdf
Sue had bronchitis and had to go to the hospital. The episode cost h.pdfayubkota
 
Subject MatlabWhich of the following is a correct statementThe.pdf
Subject MatlabWhich of the following is a correct statementThe.pdfSubject MatlabWhich of the following is a correct statementThe.pdf
Subject MatlabWhich of the following is a correct statementThe.pdfayubkota
 
Students choose nursing as a career because of different values. A .pdf
Students choose nursing as a career because of different values.  A .pdfStudents choose nursing as a career because of different values.  A .pdf
Students choose nursing as a career because of different values. A .pdfayubkota
 
String Assignment Java 1115Write a program that plays a word game .pdf
String Assignment Java 1115Write a program that plays a word game .pdfString Assignment Java 1115Write a program that plays a word game .pdf
String Assignment Java 1115Write a program that plays a word game .pdfayubkota
 
Stephanie knows that a correlation between the number of bars and th.pdf
Stephanie knows that a correlation between the number of bars and th.pdfStephanie knows that a correlation between the number of bars and th.pdf
Stephanie knows that a correlation between the number of bars and th.pdfayubkota
 
STATS CHEN 2600 Sample respondants Population unclear; could be ci.pdf
STATS CHEN 2600 Sample respondants Population unclear; could be ci.pdfSTATS CHEN 2600 Sample respondants Population unclear; could be ci.pdf
STATS CHEN 2600 Sample respondants Population unclear; could be ci.pdfayubkota
 
Statistical Review of Effective Technology Utilization Impacts on de.pdf
Statistical Review of Effective Technology Utilization Impacts on de.pdfStatistical Review of Effective Technology Utilization Impacts on de.pdf
Statistical Review of Effective Technology Utilization Impacts on de.pdfayubkota
 
Statistics in Python What hypotheticals have been discussed in th.pdf
Statistics in Python What hypotheticals have been discussed in th.pdfStatistics in Python What hypotheticals have been discussed in th.pdf
Statistics in Python What hypotheticals have been discussed in th.pdfayubkota
 
Station 1 - Task 1 Draw Draw the phylogeny of the following plants .pdf
Station 1 - Task 1 Draw Draw the phylogeny of the following plants .pdfStation 1 - Task 1 Draw Draw the phylogeny of the following plants .pdf
Station 1 - Task 1 Draw Draw the phylogeny of the following plants .pdfayubkota
 
Start up NameEdible Cutlery Problem Since the industrial revolut.pdf
Start up NameEdible Cutlery Problem Since the industrial revolut.pdfStart up NameEdible Cutlery Problem Since the industrial revolut.pdf
Start up NameEdible Cutlery Problem Since the industrial revolut.pdfayubkota
 
Starbucks est� abriendo una ubicaci�n en China cada 15 horas y acaba.pdf
Starbucks est� abriendo una ubicaci�n en China cada 15 horas y acaba.pdfStarbucks est� abriendo una ubicaci�n en China cada 15 horas y acaba.pdf
Starbucks est� abriendo una ubicaci�n en China cada 15 horas y acaba.pdfayubkota
 
Specific types of forensic accounting investigations include fraud d.pdf
Specific types of forensic accounting investigations include fraud d.pdfSpecific types of forensic accounting investigations include fraud d.pdf
Specific types of forensic accounting investigations include fraud d.pdfayubkota
 
Southwest Airlines in 2020 case study main management question(dilem.pdf
Southwest Airlines in 2020 case study main management question(dilem.pdfSouthwest Airlines in 2020 case study main management question(dilem.pdf
Southwest Airlines in 2020 case study main management question(dilem.pdfayubkota
 
Soul Soup es una organizaci�n sin fines de lucro que lleva comidas c.pdf
Soul Soup es una organizaci�n sin fines de lucro que lleva comidas c.pdfSoul Soup es una organizaci�n sin fines de lucro que lleva comidas c.pdf
Soul Soup es una organizaci�n sin fines de lucro que lleva comidas c.pdfayubkota
 
Sosyal medya, HAR� aadakilerin t�m�n� i�erir tweetler. e-kitap.pdf
Sosyal medya, HAR� aadakilerin t�m�n� i�erir tweetler. e-kitap.pdfSosyal medya, HAR� aadakilerin t�m�n� i�erir tweetler. e-kitap.pdf
Sosyal medya, HAR� aadakilerin t�m�n� i�erir tweetler. e-kitap.pdfayubkota
 
Soru 1 Aadaki vaka incelemesini okuyun ve sonraki sorular cevaplay.pdf
Soru 1 Aadaki vaka incelemesini okuyun ve sonraki sorular cevaplay.pdfSoru 1 Aadaki vaka incelemesini okuyun ve sonraki sorular cevaplay.pdf
Soru 1 Aadaki vaka incelemesini okuyun ve sonraki sorular cevaplay.pdfayubkota
 
Soru-Vaka �almas Aadaki vaka �almasn dikkatlice okuyun ve END ksm.pdf
Soru-Vaka �almas Aadaki vaka �almasn dikkatlice okuyun ve END ksm.pdfSoru-Vaka �almas Aadaki vaka �almasn dikkatlice okuyun ve END ksm.pdf
Soru-Vaka �almas Aadaki vaka �almasn dikkatlice okuyun ve END ksm.pdfayubkota
 

More from ayubkota (20)

Suponga que ha sido contratado como encargado de compras de un nuevo.pdf
Suponga que ha sido contratado como encargado de compras de un nuevo.pdfSuponga que ha sido contratado como encargado de compras de un nuevo.pdf
Suponga que ha sido contratado como encargado de compras de un nuevo.pdf
 
Supervalu, one of the largest retailers in the united states, is hea.pdf
Supervalu, one of the largest retailers in the united states, is hea.pdfSupervalu, one of the largest retailers in the united states, is hea.pdf
Supervalu, one of the largest retailers in the united states, is hea.pdf
 
Sunny Corporation has collected the following data for one of its pr.pdf
Sunny Corporation has collected the following data for one of its pr.pdfSunny Corporation has collected the following data for one of its pr.pdf
Sunny Corporation has collected the following data for one of its pr.pdf
 
Sue had bronchitis and had to go to the hospital. The episode cost h.pdf
Sue had bronchitis and had to go to the hospital. The episode cost h.pdfSue had bronchitis and had to go to the hospital. The episode cost h.pdf
Sue had bronchitis and had to go to the hospital. The episode cost h.pdf
 
Subject MatlabWhich of the following is a correct statementThe.pdf
Subject MatlabWhich of the following is a correct statementThe.pdfSubject MatlabWhich of the following is a correct statementThe.pdf
Subject MatlabWhich of the following is a correct statementThe.pdf
 
Students choose nursing as a career because of different values. A .pdf
Students choose nursing as a career because of different values.  A .pdfStudents choose nursing as a career because of different values.  A .pdf
Students choose nursing as a career because of different values. A .pdf
 
String Assignment Java 1115Write a program that plays a word game .pdf
String Assignment Java 1115Write a program that plays a word game .pdfString Assignment Java 1115Write a program that plays a word game .pdf
String Assignment Java 1115Write a program that plays a word game .pdf
 
Stephanie knows that a correlation between the number of bars and th.pdf
Stephanie knows that a correlation between the number of bars and th.pdfStephanie knows that a correlation between the number of bars and th.pdf
Stephanie knows that a correlation between the number of bars and th.pdf
 
STATS CHEN 2600 Sample respondants Population unclear; could be ci.pdf
STATS CHEN 2600 Sample respondants Population unclear; could be ci.pdfSTATS CHEN 2600 Sample respondants Population unclear; could be ci.pdf
STATS CHEN 2600 Sample respondants Population unclear; could be ci.pdf
 
Statistical Review of Effective Technology Utilization Impacts on de.pdf
Statistical Review of Effective Technology Utilization Impacts on de.pdfStatistical Review of Effective Technology Utilization Impacts on de.pdf
Statistical Review of Effective Technology Utilization Impacts on de.pdf
 
Statistics in Python What hypotheticals have been discussed in th.pdf
Statistics in Python What hypotheticals have been discussed in th.pdfStatistics in Python What hypotheticals have been discussed in th.pdf
Statistics in Python What hypotheticals have been discussed in th.pdf
 
Station 1 - Task 1 Draw Draw the phylogeny of the following plants .pdf
Station 1 - Task 1 Draw Draw the phylogeny of the following plants .pdfStation 1 - Task 1 Draw Draw the phylogeny of the following plants .pdf
Station 1 - Task 1 Draw Draw the phylogeny of the following plants .pdf
 
Start up NameEdible Cutlery Problem Since the industrial revolut.pdf
Start up NameEdible Cutlery Problem Since the industrial revolut.pdfStart up NameEdible Cutlery Problem Since the industrial revolut.pdf
Start up NameEdible Cutlery Problem Since the industrial revolut.pdf
 
Starbucks est� abriendo una ubicaci�n en China cada 15 horas y acaba.pdf
Starbucks est� abriendo una ubicaci�n en China cada 15 horas y acaba.pdfStarbucks est� abriendo una ubicaci�n en China cada 15 horas y acaba.pdf
Starbucks est� abriendo una ubicaci�n en China cada 15 horas y acaba.pdf
 
Specific types of forensic accounting investigations include fraud d.pdf
Specific types of forensic accounting investigations include fraud d.pdfSpecific types of forensic accounting investigations include fraud d.pdf
Specific types of forensic accounting investigations include fraud d.pdf
 
Southwest Airlines in 2020 case study main management question(dilem.pdf
Southwest Airlines in 2020 case study main management question(dilem.pdfSouthwest Airlines in 2020 case study main management question(dilem.pdf
Southwest Airlines in 2020 case study main management question(dilem.pdf
 
Soul Soup es una organizaci�n sin fines de lucro que lleva comidas c.pdf
Soul Soup es una organizaci�n sin fines de lucro que lleva comidas c.pdfSoul Soup es una organizaci�n sin fines de lucro que lleva comidas c.pdf
Soul Soup es una organizaci�n sin fines de lucro que lleva comidas c.pdf
 
Sosyal medya, HAR� aadakilerin t�m�n� i�erir tweetler. e-kitap.pdf
Sosyal medya, HAR� aadakilerin t�m�n� i�erir tweetler. e-kitap.pdfSosyal medya, HAR� aadakilerin t�m�n� i�erir tweetler. e-kitap.pdf
Sosyal medya, HAR� aadakilerin t�m�n� i�erir tweetler. e-kitap.pdf
 
Soru 1 Aadaki vaka incelemesini okuyun ve sonraki sorular cevaplay.pdf
Soru 1 Aadaki vaka incelemesini okuyun ve sonraki sorular cevaplay.pdfSoru 1 Aadaki vaka incelemesini okuyun ve sonraki sorular cevaplay.pdf
Soru 1 Aadaki vaka incelemesini okuyun ve sonraki sorular cevaplay.pdf
 
Soru-Vaka �almas Aadaki vaka �almasn dikkatlice okuyun ve END ksm.pdf
Soru-Vaka �almas Aadaki vaka �almasn dikkatlice okuyun ve END ksm.pdfSoru-Vaka �almas Aadaki vaka �almasn dikkatlice okuyun ve END ksm.pdf
Soru-Vaka �almas Aadaki vaka �almasn dikkatlice okuyun ve END ksm.pdf
 

Recently uploaded

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 

Recently uploaded (20)

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 

Submit only one file.sample runHuman attacks for 12 points!.pdf

  • 1. Submit only one file. sample run: Human attacks for 12 points! Elf attacks for 4 points! Balrog attacks for 27 points! Balrog speed attack inflicts 49 additional damage points! Cyberdemon attacks for 2 points! Elf attacks for 42 points! Creature 2 has 8 hit points. Balrog attacks for 19 points! Balrog speed attack inflicts 41 additional damage points! Creature 1 has -10 hit points. Creature 2 wins! Press any key to continue . . . Please follow the instructions and make the same output as the sample run above. Moreover, do proper indentations and submit only one file. (compose coding in one) (Please combine codings in one file) Suppose that you are creating a game. In this game we have four different types of creatures: humans, cyberdemons, balrogs, and elves. To represent one of these creatures we might define a Creature class as follows: class Creature ( private: int type; // 0 human, 1 cyberdemon, 2 balrog, 3 elf int strength; // How much damage we can inflict int hitpoints; // How much damage we can sustain string getspecies (); // Returns type of species, for creature class // returns "unKnown" public: Creature( ); // Initialize to human, 10 strength, 10 hit points Creature(int newType, int newstrength, int newHit); // Initialize creature to new type, strength, hit points // Also add appropriate accessor and mutator functions // for type, strength, and hit points int getdamage (); // Returns amount of damage this creature // inflicts in one round of combat Here is an initial implementation of the getspecies ( ) function: string Creature::getspecies () { switch (type) { case 0: return "Human"; case 1: return "Cyberdemon"; case 2: return "Balrog"; case 3: return "Elf"; } return "Unknown"; The getDamage ( ) function
  • 2. outputs and returns the damage this creature can inflict in one round of combat. The rules for calculating the damage are as follows: - Every creature inflicts damage that is a random number r, where 0