SlideShare una empresa de Scribd logo
1 de 3
Please write a new code as i need mines to be written differently than the one ALREADY
answered here.
Thanks
client and output provided
Here is the client program that you must use to test your classes.
Here is the correct output. Your output should match this exactly except where random numbers
are used.
Solution
class creature {
private :
int type;
int strength;
int hitpoints;
string getspecies() const;
public:
creature();
creature (int newtype, int newstrength, int newhitpoints);
int getDamage() const;
};
string creature :: getspecies() const{
switch(type);
{
case 0:
return "Human";
case 1:
retrun "Cyberdemon";
case 2:
return "balrog";
case 3:
return "Elf";
}
return unkown;
}
int creature :: getDamage(){
int damage;
damage=(rand()%strength)+1;
cout<<getspecies()<<"attacks for"<<damage<<"point"<<endl;
if(type==2 || type==1){
if (rand()%4==0)
{
damage=damage+50;
cout<<"Denomic attacks inflicts 50 Additional damage point:"<<endl;
}
}
if(type ==3)
{
if rand()%2==0)
{
cout<<"Magical attacks inflict"<<damage<<"Additional damage points:"<<endl;
damage*=2;
}
}
if (type==2)
{ int damage2=rand()%strength)+1;
cout<<"balrog speed attack inflicts"<<damage2<<"Additional damage points:"<<endl;
damage=damage+damage2;
}
return damage;
}

Más contenido relacionado

Similar a Please write a new code as i need mines to be written differently than.docx

Smart Pointer in C++
Smart Pointer in C++Smart Pointer in C++
Smart Pointer in C++
永泉 韩
 
Describe the complete pipeline in ML using programming through PyTorch.pdf
Describe the complete pipeline in ML using programming through PyTorch.pdfDescribe the complete pipeline in ML using programming through PyTorch.pdf
Describe the complete pipeline in ML using programming through PyTorch.pdf
BorisdFHFraserk
 
You will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdfYou will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdf
FashionColZone
 
AnswerNote Provided code shows several bugs, hence I implemented.pdf
AnswerNote Provided code shows several bugs, hence I implemented.pdfAnswerNote Provided code shows several bugs, hence I implemented.pdf
AnswerNote Provided code shows several bugs, hence I implemented.pdf
anurag1231
 
C++ AssignmentPlease read all the requirements and the overloading.pdf
C++ AssignmentPlease read all the requirements and the overloading.pdfC++ AssignmentPlease read all the requirements and the overloading.pdf
C++ AssignmentPlease read all the requirements and the overloading.pdf
lakshmijewellery
 
I have tried running this code below- and it is working- but the accur.pdf
I have tried running this code below- and it is working- but the accur.pdfI have tried running this code below- and it is working- but the accur.pdf
I have tried running this code below- and it is working- but the accur.pdf
GordonF2XPatersonh
 
Complete the following code segment to handle potential zero denomin.pdf
Complete the following code segment to handle potential zero denomin.pdfComplete the following code segment to handle potential zero denomin.pdf
Complete the following code segment to handle potential zero denomin.pdf
americanopticalscbe
 
Can someone please explain what the code below is doing and comment on.pdf
Can someone please explain what the code below is doing and comment on.pdfCan someone please explain what the code below is doing and comment on.pdf
Can someone please explain what the code below is doing and comment on.pdf
kuldeepkumarapgsi
 

Similar a Please write a new code as i need mines to be written differently than.docx (17)

Smart Pointer in C++
Smart Pointer in C++Smart Pointer in C++
Smart Pointer in C++
 
Describe the complete pipeline in ML using programming through PyTorch.pdf
Describe the complete pipeline in ML using programming through PyTorch.pdfDescribe the complete pipeline in ML using programming through PyTorch.pdf
Describe the complete pipeline in ML using programming through PyTorch.pdf
 
Analysis of Microsoft Code Contracts
Analysis of Microsoft Code ContractsAnalysis of Microsoft Code Contracts
Analysis of Microsoft Code Contracts
 
You will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdfYou will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdf
 
WINSEM2016-17_CSE1002_LO_1336_24-JAN-2017_RM003_session 10.pptx
WINSEM2016-17_CSE1002_LO_1336_24-JAN-2017_RM003_session 10.pptxWINSEM2016-17_CSE1002_LO_1336_24-JAN-2017_RM003_session 10.pptx
WINSEM2016-17_CSE1002_LO_1336_24-JAN-2017_RM003_session 10.pptx
 
Please follow the code and comments for description and outputs C.pdf
Please follow the code and comments for description and outputs C.pdfPlease follow the code and comments for description and outputs C.pdf
Please follow the code and comments for description and outputs C.pdf
 
Import java
Import javaImport java
Import java
 
AnswerNote Provided code shows several bugs, hence I implemented.pdf
AnswerNote Provided code shows several bugs, hence I implemented.pdfAnswerNote Provided code shows several bugs, hence I implemented.pdf
AnswerNote Provided code shows several bugs, hence I implemented.pdf
 
C++ AssignmentPlease read all the requirements and the overloading.pdf
C++ AssignmentPlease read all the requirements and the overloading.pdfC++ AssignmentPlease read all the requirements and the overloading.pdf
C++ AssignmentPlease read all the requirements and the overloading.pdf
 
Welcome to Modern C++
Welcome to Modern C++Welcome to Modern C++
Welcome to Modern C++
 
OverviewWe will be adding some validation to our Contact classes t.pdf
OverviewWe will be adding some validation to our Contact classes t.pdfOverviewWe will be adding some validation to our Contact classes t.pdf
OverviewWe will be adding some validation to our Contact classes t.pdf
 
I have tried running this code below- and it is working- but the accur.pdf
I have tried running this code below- and it is working- but the accur.pdfI have tried running this code below- and it is working- but the accur.pdf
I have tried running this code below- and it is working- but the accur.pdf
 
Mobile Weekend Budapest presentation
Mobile Weekend Budapest presentationMobile Weekend Budapest presentation
Mobile Weekend Budapest presentation
 
Complete the following code segment to handle potential zero denomin.pdf
Complete the following code segment to handle potential zero denomin.pdfComplete the following code segment to handle potential zero denomin.pdf
Complete the following code segment to handle potential zero denomin.pdf
 
Chainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみたChainer-Compiler 動かしてみた
Chainer-Compiler 動かしてみた
 
Can someone please explain what the code below is doing and comment on.pdf
Can someone please explain what the code below is doing and comment on.pdfCan someone please explain what the code below is doing and comment on.pdf
Can someone please explain what the code below is doing and comment on.pdf
 
Practice
PracticePractice
Practice
 

Más de helenc18

The sound strikes the cantina walls and bounces off at the same angle.docx
The sound strikes the cantina walls and bounces off at the same angle.docxThe sound strikes the cantina walls and bounces off at the same angle.docx
The sound strikes the cantina walls and bounces off at the same angle.docx
helenc18
 
The sale of stock and the sale of bonds are reported as financing acti.docx
The sale of stock and the sale of bonds are reported as financing acti.docxThe sale of stock and the sale of bonds are reported as financing acti.docx
The sale of stock and the sale of bonds are reported as financing acti.docx
helenc18
 
Prepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docx
Prepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docxPrepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docx
Prepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docx
helenc18
 

Más de helenc18 (19)

The total electromagnetic power emitted by the sun is 3-8 x 1026 W- Th.docx
The total electromagnetic power emitted by the sun is 3-8 x 1026 W- Th.docxThe total electromagnetic power emitted by the sun is 3-8 x 1026 W- Th.docx
The total electromagnetic power emitted by the sun is 3-8 x 1026 W- Th.docx
 
The Tinsley Company exchanged land that it had been holding for future.docx
The Tinsley Company exchanged land that it had been holding for future.docxThe Tinsley Company exchanged land that it had been holding for future.docx
The Tinsley Company exchanged land that it had been holding for future.docx
 
The State of Rhode Island publishes its budget and the various support.docx
The State of Rhode Island publishes its budget and the various support.docxThe State of Rhode Island publishes its budget and the various support.docx
The State of Rhode Island publishes its budget and the various support.docx
 
The SRLY rules for consolidated tax returns are designed to keep corpo.docx
The SRLY rules for consolidated tax returns are designed to keep corpo.docxThe SRLY rules for consolidated tax returns are designed to keep corpo.docx
The SRLY rules for consolidated tax returns are designed to keep corpo.docx
 
The sound strikes the cantina walls and bounces off at the same angle.docx
The sound strikes the cantina walls and bounces off at the same angle.docxThe sound strikes the cantina walls and bounces off at the same angle.docx
The sound strikes the cantina walls and bounces off at the same angle.docx
 
The six platforms below are initially at rest in deep space- The indic.docx
The six platforms below are initially at rest in deep space- The indic.docxThe six platforms below are initially at rest in deep space- The indic.docx
The six platforms below are initially at rest in deep space- The indic.docx
 
The rise of various digital communication methods in the past decade h.docx
The rise of various digital communication methods in the past decade h.docxThe rise of various digital communication methods in the past decade h.docx
The rise of various digital communication methods in the past decade h.docx
 
The reason that the increase in population growth in the 19th and 20th.docx
The reason that the increase in population growth in the 19th and 20th.docxThe reason that the increase in population growth in the 19th and 20th.docx
The reason that the increase in population growth in the 19th and 20th.docx
 
The sale of stock and the sale of bonds are reported as financing acti.docx
The sale of stock and the sale of bonds are reported as financing acti.docxThe sale of stock and the sale of bonds are reported as financing acti.docx
The sale of stock and the sale of bonds are reported as financing acti.docx
 
Precipitation volumetric analysis involves formation reactions of solu.docx
Precipitation volumetric analysis involves formation reactions of solu.docxPrecipitation volumetric analysis involves formation reactions of solu.docx
Precipitation volumetric analysis involves formation reactions of solu.docx
 
POST-LAB QUESTIONS 1- Based on your observations- what aimilarities di.docx
POST-LAB QUESTIONS 1- Based on your observations- what aimilarities di.docxPOST-LAB QUESTIONS 1- Based on your observations- what aimilarities di.docx
POST-LAB QUESTIONS 1- Based on your observations- what aimilarities di.docx
 
Portman Corporation has retained earnings of $675-000 at January 1- 20.docx
Portman Corporation has retained earnings of $675-000 at January 1- 20.docxPortman Corporation has retained earnings of $675-000 at January 1- 20.docx
Portman Corporation has retained earnings of $675-000 at January 1- 20.docx
 
Please write it in Microsoft Word- Not in handwritten form- I-'ll give.docx
Please write it in Microsoft Word- Not in handwritten form- I-'ll give.docxPlease write it in Microsoft Word- Not in handwritten form- I-'ll give.docx
Please write it in Microsoft Word- Not in handwritten form- I-'ll give.docx
 
please write carefully and explain clearly- Thank you-SolutionKsp of C.docx
please write carefully and explain clearly- Thank you-SolutionKsp of C.docxplease write carefully and explain clearly- Thank you-SolutionKsp of C.docx
please write carefully and explain clearly- Thank you-SolutionKsp of C.docx
 
Prioritize the three themes of integrated solid waste management- 1^st.docx
Prioritize the three themes of integrated solid waste management- 1^st.docxPrioritize the three themes of integrated solid waste management- 1^st.docx
Prioritize the three themes of integrated solid waste management- 1^st.docx
 
present synchronized savage code while (1) { getServingFromPot ()- ea.docx
present synchronized savage code while (1) {  getServingFromPot ()- ea.docxpresent synchronized savage code while (1) {  getServingFromPot ()- ea.docx
present synchronized savage code while (1) { getServingFromPot ()- ea.docx
 
Prepare general journal entries to record the following transactions f.docx
Prepare general journal entries to record the following transactions f.docxPrepare general journal entries to record the following transactions f.docx
Prepare general journal entries to record the following transactions f.docx
 
Prepare functional specifications for the company-'s use of the Web an.docx
Prepare functional specifications for the company-'s use of the Web an.docxPrepare functional specifications for the company-'s use of the Web an.docx
Prepare functional specifications for the company-'s use of the Web an.docx
 
Prepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docx
Prepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docxPrepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docx
Prepare a 3 to 5 paragraph briefing statement which explains the 3 mos.docx
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
fonyou31
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Último (20)

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 

Please write a new code as i need mines to be written differently than.docx

  • 1. Please write a new code as i need mines to be written differently than the one ALREADY answered here. Thanks client and output provided Here is the client program that you must use to test your classes. Here is the correct output. Your output should match this exactly except where random numbers are used. Solution class creature { private : int type; int strength; int hitpoints; string getspecies() const; public: creature(); creature (int newtype, int newstrength, int newhitpoints); int getDamage() const; };
  • 2. string creature :: getspecies() const{ switch(type); { case 0: return "Human"; case 1: retrun "Cyberdemon"; case 2: return "balrog"; case 3: return "Elf"; } return unkown; } int creature :: getDamage(){ int damage; damage=(rand()%strength)+1; cout<<getspecies()<<"attacks for"<<damage<<"point"<<endl; if(type==2 || type==1){ if (rand()%4==0) { damage=damage+50; cout<<"Denomic attacks inflicts 50 Additional damage point:"<<endl;
  • 3. } } if(type ==3) { if rand()%2==0) { cout<<"Magical attacks inflict"<<damage<<"Additional damage points:"<<endl; damage*=2; } } if (type==2) { int damage2=rand()%strength)+1; cout<<"balrog speed attack inflicts"<<damage2<<"Additional damage points:"<<endl; damage=damage+damage2; } return damage; }