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 15:30
Some of the items below indicate the steps required to move a slide to a different location in a presentation. select those steps and indicate the order in which they should be performed to move the slide. (for example, if an item describes what you do first, select 1.) included in the list are items that are not part of the process. for these items, select n/a, an abbreviation for not applicable. 1 — first 2 — second 3 — third 4 — fourth 5 — fifth 6 — sixth n/a — not applicable drag the slide to the desired place. enter the slide position desired. hold the mouse button down. select move from the tools menu. select the slide. switch to the notes view.
Answers: 3
question
Computers and Technology, 22.06.2019 08:00
What is the first step in creating a maintenance ?
Answers: 2
question
Computers and Technology, 22.06.2019 19:10
What a backup plan that you have created in a event you encounter a situation
Answers: 2
question
Computers and Technology, 22.06.2019 21:00
Write a method so that the main() code below can be replaced by the simpler code that calls method original main(): public class calcmiles { public static void main(string [] args) { double milesperhour; double minutestraveled; double hourstraveled; double milestraveled; milesprhour = scnr.nextdouble(); minutestraveled = scnr.nextdouble(); hourstraveled = minutestraveled / 60.0; milestraveled = hourstraveled * milesperhour; system.out.println("miles: " + milestraveled); } }
Answers: 2
You know the right answer?
Suppose that you were given an unfinished, partially written class, which was created for a fantasy...
Questions
question
Business, 04.02.2021 17:40
question
Mathematics, 04.02.2021 17:40
question
Social Studies, 04.02.2021 17:40
question
Geography, 04.02.2021 17:40
question
History, 04.02.2021 17:40
question
Mathematics, 04.02.2021 17:40
Questions on the website: 13722363