Define a function in class Frodo that is called FellowshipOfTheRing(5pts)1.1 This function should take no inputs and should use void for the return type (5pts)1.1 Call this function in main through...

Define a function in class Frodo that is called FellowshipOfTheRing(5pts)1.1 This function should take no inputs and should use void for the return type (5pts)1.1 Call this function in main through the frodo object (5pts)1.3 When this function is called in main, it should output the text “You shall not pass!” (5pts)2.Define a function in the class Sauron that is called Attack (5pts)2.1 This function should only have one parameter called heroInput that is of type Frodo (5pts)2.2 The parameter for this function should have a reference in it (5pts)2.3 Call the Attack function in main through the Sauron object and pass the Frodo object in asinput (5pts)2.4 When the call ends, the frodo m_Health member variable should hold a value of 30(5pts)3. Overload the constructor for the Frodo class and Sauron class so that you do not have to provide anyinputs when the objects are instantiated. (In other words create a default constructor for eachclass)(20pts)4. Create a function template below main called ShowCharacterHealth (20pts)4.1. This function should be able to take either object (frodo/Sauron) as input and show theirhealth. (5pts)
4.1 Call the ShowCharacterHealth 2 times in main. The first call should pass in the frodo objectand the second call should pass in the sauron object. (5pts)
4.2 You must specify a different data type each time you call ShowCharacterHealth. (5pts)


TEST 3 C++ Copy and paste the following code in a new project #include #include using namespace std; class Frodo { public: Frodo(float health, float strength, float stamina) : m_Health{ health }, m_Strength{ strength }, m_Stamina{ stamina } { } void CalculateHealth(float newHealth) { m_Health += newHealth; } float GetHealth() { return m_Health; } private: float m_Health = 100.0f; float m_Strength = 22.0f; float m_Stamina = 35.0f; bool m_IsDead = false; }; class Sauron { public: Sauron(double health, float strength, float stamina) : m_Health{ health }, m_Strength{ strength }, m_Stamina{ stamina } { } double GetHealth() { return m_Health; } private: double m_Health = 5000.0; float m_Strength = 300.0f; float m_Stamina = 200.0f; bool m_IsDead = false;//True is barely an option......... }; int main() { Sauron sauron(7000.0,350,250); Frodo frodo(90.0f,20,30); } 1. Define a function in class Frodo that is called FellowshipOfTheRing(5pts) 1.1 This function should take no inputs and should use void for the return type (5pts) 1.1 Call this function in main through the frodo object (5pts) 1.3 When this function is called in main, it should output the text “You shall not pass!” (5pts) 2. Define a function in the class Sauron that is called Attack (5pts) 2.1 This function should only have one parameter called heroInput that is of type Frodo (5pts) 2.2 The parameter for this function should have a reference in it (5pts) 2.3 Call the Attack function in main through the Sauron object and pass the Frodo object in as input (5pts) 2.4 When the call ends, the frodo m_Health member variable should hold a value of 30(5pts) 3. Overload the constructor for the Frodo class and Sauron class so that you do not have to provide any inputs when the objects are instantiated. (In other words create a default constructor for each class)(20pts) ------------------------------------------------------------------------------------------------------------------------------------------ My Precious! 4. Create a function template below main called ShowCharacterHealth (20pts) 4.1. This function should be able to take either object (frodo/Sauron) as input and show their health. (5pts) 4.1 Call the ShowCharacterHealth 2 times in main. The first call should pass in the frodo object and the second call should pass in the sauron object. (5pts) 4.2 You must specify a different data type each time you call ShowCharacterHealth. (5pts) Bad Coding Practices ------------------------------------------------------------------------------------------------------------------------------------------ No comments= -5 Bad coding practices (Braces unorganized, poorly chosen names, names not consistent (camel or _), unorganized spacing, not using prototypes(with functions on the bottom), not using header files, not defining functions outside of class) = - The amount of points taken off will be up to the instructors discretion If I help you during test to get your code to run = -11 If your code cannot compile when I check it = -11 Stressed??? No need to worry, you are here now…………
Dec 14, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here