Answered step by step
Verified Expert Solution
Question
1 Approved Answer
can someone JUST write the MAKEFILE for this its C++ You will make a class Character to represent the orc and the fighter. This will
can someone JUST write the MAKEFILE for this its C++
You will make a class Character to represent the orc and the fighter. This will include both Character.h and Character.cc files. In addition you will have files battle.h and battle.cc. These two files should define two global fight functions in different namespaces. Note: battle is not a class. The battle.h file contains the function prototypes and the battle.cc contains the function implementations. Finally you will have a main.cc file with a main function to run the battle. 4.2 Makefile Your Makefile should make two object files, Character and battle,o, and link these object files into your exe cutable file pi. For example, to make the Character o file you could use the commands: Character.o: Character.h Character.co g++ -c Character.cc In addition your Makefile should contain an all command that creates the pi executable and a clean command that removes all executables and object files. 4.3 Character Class Remember to put header guards in the header file. All member wariables are private unless otherwise specified. All member functions are public unless otherwise specified 1. Member variables: (a) string name (b) intogers for maxHealth, current Health and damage. 2. A three argument constructor Character (const string&, int maxHealth, int damage). Use the parame- ters to initialize the member variables. Initialize current Health to be equal to maxkoalth 3. Make a getter for the name member variable. 4. Member functions (a) void takeDamage(int damage). Subtract the parameter value from the current Health. If currentHealth drops below 0, reset it to 0. (b) int strike(). This is essentially in getter for the damage parameter. Return the damage tombor variable (C) vold print Print the name and current health of the character to the console in whatever format you like, Be sure to include header guards in this header file. You will write two global functions, each in their own namespace. Both have the same function signature. void fight (Characterfighter, Characterk orc). One should be in the Gondor namespace, and one should be in the Mordor namespace. Put the function prototypes in battle.h and put the function implementations in battle.ca Every time the characters fight, they each strike one blow. So use strike to retrieve the damage and apply that (takeDamage to the other character. If they fight in Gondor (that is, using the namespace Gondor), the fighter should add 1 to their damage and the orc should subtract 1 from their damage. If they fight in Morder then the orc should add 1 to their damage and the fighter should subtract 1 from their damage. Write out an appropriate description. For example: >Snarl hits Thor for 3 damage! 4.5 main.cc Make a main function. It should do the following: 1. Prompt the user to input the name, max health, and damage for a fighter character 2. Initialize a fighter Character with those parameters. 3. Prompt the user to input the name, max health, and damage for an orc character 4. Initialize an ore Character with those parameters. 5. Print out both characters. 6. Have the characters fight in Gondor (make sure the fighter character is the first parameter). 7. Print out both characters. 8. Have the characters fight in Mordor (make sure the fighter character is the first parameter). 9. Print out both characters Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started