subject

Suppose that you were given an unfinished, partially written class, which was created for a fantasy role-playing game. There are four different types of creatures in this game: humans, cyberdemons, balrogs, and elves. One problem with this implementation is that it is unwieldy to add new creatures. You have to modify the class to make it more robust and extensible. In this game, we have four different types of creatures: humans, cyberdemons, balrogs, and elves. Rewrite the class to use inheritance, which will eliminate the need for the variable type: • The Creature class should be the base class. • The classes Demon , Elf, and Human should be derived from Creature. • The classes Cyberdemon and Balrog should be derived from Demon. • You will need to rewrite the getSpecies( ) and getDamage( ) functions so they are appropriate for each class. The getDamage( ) function in each class should only compute the damage appropriate for that object. The total damage is then calculated by combining the results of getDamage( ) at each level of the inheritance hierarchy. As an example, invoking getDamage( ) for a Balrog object should invoke getDamage( ) for the Demon object, which should invoke getDamage( ) for the Creature object. This will compute the basic damage that all creatures inflict, followed by the random 5% damage that demons inflict, followed by the double damage

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:00
2.)how does a graphical user interface (gui) on a touchscreen interface differ from a gui on a desktop or laptop? a.)a finger or stylus is used instead of a pointer. b.) a magic wand is used instead of a pointer. c.)users speak commands instead of using a pointer. d.)users visualize commands instead of using a pointer.
Answers: 1
question
Computers and Technology, 22.06.2019 11:30
Hassan is writing his master’s thesis, which is a thirty-page document. he received some feedback from his professor in the form of comments, but does not see where the comments are. what is the fastest way for hassan to find the feedback?
Answers: 3
question
Computers and Technology, 22.06.2019 20:00
Need asap write a short paper describing the history and differences between six sigma, waterfall, agile, and scrum models. understanding these models can give you a good idea of how diverse and interesting it development projects can be. describe what the rationale for them is and describe their key features. describe the history behind their development. at least 400 words
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Which of the following would you find on a network
Answers: 3
You know the right answer?
Suppose that you were given an unfinished, partially written class, which was created for a fantasy...
Questions
question
Chemistry, 27.10.2020 17:10
question
Arts, 27.10.2020 17:10
question
History, 27.10.2020 17:10
Questions on the website: 13722360