Adhere to the following additional requirements: Each of the 6 classes will have exactly 2 constructors. Every class will have a getSpecies() function. We won't be declaring objects of type "Creature" or "Demon", but you should include getSpecies() functions for them anyway, and they should return "Creature" and "Demon", respectively. Make getSpecies() a public member instead of private. Each of the 5 derived classes will have exactly 4 member functions (including constructors) and no data members The Creature class will have 8 member functions (including 2 constructors, 2 accessors, and 2 mutators) and 2 data members. Do not use the "protected" keyword. Many computer programmers consider it to be poor practice because only the base class itself should have uncontrolled access to that data. The derived classes can access the data members through accessors and mutators. In the non-default constructors for the sub-classes, you will need to use initializer lists. The Creature class's getDamage() function will return an int representing the damage inflicted. It will contain no cout statements. The Human class's getDamage() function will (1) call the Creature class's getDamage() function to determine the damage inflicted and (2) print the message reporting the damage inflicted. To review, the syntax for calling the Creature class's getDamage() will be Creature::getDamage(). The Elf class's getDamage() function will be just the same as for the Human class, except there will be some additional couts and calculations after the initial damage inflicted is reported. The Cyberdemon class's getDamage() function will (1) print the words "The Cyberdemon" and (2) call the Demon class's getDamage() function to determine the damage. The words "The Cyberdemon" have to be printed here before calling the Demon class's getDamage() function because once we are inside the Demon class's getDamage() function there is no way for us to determine which type of Demon (Cyberdemon or Balrog) we are working with. The Balrog class's getDamage() function will (1) print the words "The Balrog", (2) call the Demon class's getDamage() function to determine the damage, (3) calculate the damage inflicted by the Balrog's second attack (which is a basic "Creature" attack), and (4) print those results. Don't call the Creature class's getDamage() function to calculate the damage inflicted by the second attack. Instead use something like "damage2 = (rand() % strength) + 1;". The Demon class's getDamage() function will (1) call the Creature class's getDamage() function to determine the damage inflicted, (2) print the words "attacks for ?? points!", (3) determine whether a demonic attack occurs, and if so, (4) print the "Demonic attack" message. All 6 getDamage() functions will return the damage inflicted. You must place all of your classes, both the interface and the implementation, in a namespace named "cs_creature".

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Adhere to the following additional requirements:

  • Each of the 6 classes will have exactly 2 constructors. Every class will have a getSpecies() function. We won't be declaring objects of type "Creature" or "Demon", but you should include getSpecies() functions for them anyway, and they should return "Creature" and "Demon", respectively. Make getSpecies() a public member instead of private.
  • Each of the 5 derived classes will have exactly 4 member functions (including constructors) and no data members
  • The Creature class will have 8 member functions (including 2 constructors, 2 accessors, and 2 mutators) and 2 data members.
  • Do not use the "protected" keyword. Many computer programmers consider it to be poor practice because only the base class itself should have uncontrolled access to that data. The derived classes can access the data members through accessors and mutators.
  • In the non-default constructors for the sub-classes, you will need to use initializer lists.
  • The Creature class's getDamage() function will return an int representing the damage inflicted. It will contain no cout statements.
  • The Human class's getDamage() function will (1) call the Creature class's getDamage() function to determine the damage inflicted and (2) print the message reporting the damage inflicted. To review, the syntax for calling the Creature class's getDamage() will be Creature::getDamage().
  • The Elf class's getDamage() function will be just the same as for the Human class, except there will be some additional couts and calculations after the initial damage inflicted is reported.
  • The Cyberdemon class's getDamage() function will (1) print the words "The Cyberdemon" and (2) call the Demon class's getDamage() function to determine the damage. The words "The Cyberdemon" have to be printed here before calling the Demon class's getDamage() function because once we are inside the Demon class's getDamage() function there is no way for us to determine which type of Demon (Cyberdemon or Balrog) we are working with.
  • The Balrog class's getDamage() function will (1) print the words "The Balrog", (2) call the Demon class's getDamage() function to determine the damage, (3) calculate the damage inflicted by the Balrog's second attack (which is a basic "Creature" attack), and (4) print those results. Don't call the Creature class's getDamage() function to calculate the damage inflicted by the second attack. Instead use something like "damage2 = (rand() % strength) + 1;".
  • The Demon class's getDamage() function will (1) call the Creature class's getDamage() function to determine the damage inflicted, (2) print the words "attacks for ?? points!", (3) determine whether a demonic attack occurs, and if so, (4) print the "Demonic attack" message.
  • All 6 getDamage() functions will return the damage inflicted.
  • You must place all of your classes, both the interface and the implementation, in a namespace named "cs_creature".

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Software Development
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education