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, 22.06.2019 17:00
Aisha has finished working on a word processing document that contains 15 pages. she has added some special elements in the first three pages, page 9 and 10, and page 15 from the document. she wants to print only these pages to see how they look. which option is the correct way to represent (in the print dialog box) the pages that aisha wants to print
Answers: 3
question
Computers and Technology, 23.06.2019 06:00
What makes myhexadecimalnumber a child of mynumber? which methods does myhexadecimalnumber inherit directly from the mynumber class? what can an instance of the mynumber class do? what can an instance of the myhexadecimalnumber class do? which methods are overridden? why are they overridden? how many examples of overloading are there? why was this done? where is the super keyword used? what is it doing? why isn’t the incoming value set immediately in the second myhexadecimalnumber constructor? how many examples can you find of an inherited method being called?
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
Drag the tiles to the correct boxes to complete the pairs. match the errors with their definitions. #name #value #ref when a formula produces output that is too lengthy to fit in the spreadsheet cell arrowright when you enter an invalid cell reference in a formula arrowright when you type text in cells that accept numeric data arrowright when you type in a cell reference that doesn’t exist arrowright reset next
Answers: 1
question
Computers and Technology, 23.06.2019 20:00
Match the file formats with the types of multimedia they can store
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
Mathematics, 07.10.2020 01:01
question
Social Studies, 07.10.2020 01:01
Questions on the website: 13722362