Question: Develop a Java class that meets the following requirements and represents your own unique game character ( with a unique name that is not Character

Develop a Java class that meets the following requirements and represents your own unique game character (with a unique name that is not Character). Since all submitted game character classes will implement the same Java interface, they will all be type compatible. After all submissions are in, game characters will face each other in a tournament style elimination competition!
1. Create a class data field of type either 2-4 tree (Tree24 class) or red black tree (RBTree class) to store the experiences of the character, where each experience is a String object
2. Create a WeightedGraph data field with generic type Character, to store the weighted connections between the Character and other game characters (allies), where the weight represents the amount of assistance the other character can provide.
3. Create class data fields for the characters name (String) and health points (Integer, at most 100)
4. The class must implement the Character interface supplied with this assignment, meaning it must fully implement the following methods
(a) A getName method to return the name of the character
(b) An intro method to print a message introducing the character, including the characters name, health points, experiences in String order and the names of their allies
(c) An attack method to simulate performing an attack with the characters unique capabilities, by printing text. The method must return a randomized int amount of damage at most 10health points caused by the attack
(d) A defend method to simulate defending against an attack with the characters unique capabilities, by printing text, and also reducing the characters healthpoints.
The method accepts an integer parameter attackpoints as the number of health points the attack would deduct without defense. The method produces a random integer def ense from 0 to attackpoints and then reduces the characters health points by an amount equal to attackpoints defense. The method must return the amount of health points the character has lost.
(e) An addAlly method to add a separate character (Character type, meaning the Character interface) as an ally by adding the other character object into this characters ally graph by making a weighted edge between this character object and the ally character
(f) An addExperience method to add a new (String) experience for this character by adding the new String to this characters experience search tree

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!