Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For those knights that survived the Knight Fight, it's now time for your next adventure Sir Jav-a-lot must now travel through JavaBean Forest in order

image text in transcribed

For those knights that survived the "Knight Fight", it's now time for your next adventure Sir Jav-a-lot must now travel through JavaBean Forest in order to get to his final destination. Unfortunately for Sir Jav-A Lot, it's midnight, visibility is zero and JavaBean Forest is full of the most evil characters! Not just other Knights, but also Oracle Ogres, Linux Leprechauns and those midnight Wally Wal-Mart customers! So the idea is that Sir Jav-A-Lot will encounter random threats throughout this journey of which will be generated at run time, hence polymorphism 1. Create an Enemy abstract superclass that fights with the Knight with the abstract method fight that must be 2. The enemy superclass should have a takeDamage method with an implementation in the superclass and maintain an 3. The superclass must also have a static getRandomEnemy method that returns a random Enemy object (use the overridden and returns an int for damage int that represents the enemy's health. It should also have all of the appropriate accessors and mutators. Random generator in the java library) which it instantiates from one of the three implementations below (this is called a static method factory and is used extensively in the java library) 4. You must also create a custom Exception method that is thrown by the superclass when negative damage is passed to the takeDamage method as this is invalid (for example InvalidDamageException) 5. When you set up the attack, request how many enemies your knight sees. Call the getRandomEnemy method that number of times and see how your knight does. Since you don't know which Enemy object will be returned you must build the class around Enemy (also called building to an interface (or abstract class) rather than an implementation) Note that this uses polymorphism as the driver program has no knowledge of the underlying implementation of Enemy Note: This is a tough concept to grasp, so start early and post ALL questions to the discussion board! Acceptance Criteria 1. Have at least 3 implementations (i.e. ogre, sorcerer, troll, or whatever you can dream up) of the superclass enemy, but only encounter 1 of those implementations randomly. You must override both the toString method inherited from Object defining the enemy and the fight method inherited from the abstract superclass 2. Creation of at least one standard exception used in the book. 3. Creation of at least one custom exception of your own creation. Extra Credit: 1. Feel free to spice up the fight with different types of moves and attacks that make sense with the type of enemy (like a sorcerer is probably resistant to magic attack and probably uses them often). +10pts 2. Have at least 3 implementations (i.e. ogre, sorcerer, troll, or whatever you can dream up) of the superclass enemy with the random encounter of at least 2 of them. You must override both the toString method inherited from Object defining the enemy and the fight method inherited from the abstract superclass. +10pts Zip up the files and title the zip with the following format: lastname, first initial, underscore, assign5 (ie John Doe would For those knights that survived the "Knight Fight", it's now time for your next adventure Sir Jav-a-lot must now travel through JavaBean Forest in order to get to his final destination. Unfortunately for Sir Jav-A Lot, it's midnight, visibility is zero and JavaBean Forest is full of the most evil characters! Not just other Knights, but also Oracle Ogres, Linux Leprechauns and those midnight Wally Wal-Mart customers! So the idea is that Sir Jav-A-Lot will encounter random threats throughout this journey of which will be generated at run time, hence polymorphism 1. Create an Enemy abstract superclass that fights with the Knight with the abstract method fight that must be 2. The enemy superclass should have a takeDamage method with an implementation in the superclass and maintain an 3. The superclass must also have a static getRandomEnemy method that returns a random Enemy object (use the overridden and returns an int for damage int that represents the enemy's health. It should also have all of the appropriate accessors and mutators. Random generator in the java library) which it instantiates from one of the three implementations below (this is called a static method factory and is used extensively in the java library) 4. You must also create a custom Exception method that is thrown by the superclass when negative damage is passed to the takeDamage method as this is invalid (for example InvalidDamageException) 5. When you set up the attack, request how many enemies your knight sees. Call the getRandomEnemy method that number of times and see how your knight does. Since you don't know which Enemy object will be returned you must build the class around Enemy (also called building to an interface (or abstract class) rather than an implementation) Note that this uses polymorphism as the driver program has no knowledge of the underlying implementation of Enemy Note: This is a tough concept to grasp, so start early and post ALL questions to the discussion board! Acceptance Criteria 1. Have at least 3 implementations (i.e. ogre, sorcerer, troll, or whatever you can dream up) of the superclass enemy, but only encounter 1 of those implementations randomly. You must override both the toString method inherited from Object defining the enemy and the fight method inherited from the abstract superclass 2. Creation of at least one standard exception used in the book. 3. Creation of at least one custom exception of your own creation. Extra Credit: 1. Feel free to spice up the fight with different types of moves and attacks that make sense with the type of enemy (like a sorcerer is probably resistant to magic attack and probably uses them often). +10pts 2. Have at least 3 implementations (i.e. ogre, sorcerer, troll, or whatever you can dream up) of the superclass enemy with the random encounter of at least 2 of them. You must override both the toString method inherited from Object defining the enemy and the fight method inherited from the abstract superclass. +10pts Zip up the files and title the zip with the following format: lastname, first initial, underscore, assign5 (ie John Doe would

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

d. What language(s) did they speak?

Answered: 1 week ago