SlideShare une entreprise Scribd logo
1  sur  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;
}

Contenu connexe

Similaire à 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
 

Similaire à 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
 
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
 
C# 6Write a program that creates a Calculation ClassUse the foll.pdf
C# 6Write a program that creates a Calculation ClassUse the foll.pdfC# 6Write a program that creates a Calculation ClassUse the foll.pdf
C# 6Write a program that creates a Calculation ClassUse the foll.pdf
 

Plus 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
 

Plus 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
 

Dernier

Dernier (20)

FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
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...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
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
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
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
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
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
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
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
 

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; }