Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Use Java Created Character Class Associated Getter Setters Create Friendly Subclass Feel F Q35551459

usejava, i have created a character class and associated getter andsetters, create a Friendly subclass:feel free to add to the interact abstract class:
You will be required to design and impiement four other classes to achieve the specifications below. These classes are all co. (15 Friendly (5) Correct constructor -[10] Correct interactioncharcter.java:▶ Character-java Friendlyjava 1 public abstract class Character int health; int maxHealth; String name; // Feel free to add iYou will be required to design and impiement four other classes to achieve the specifications below. These classes are all concrete, meaning one should be able to create an instance of them. Friendly Character Subclass Create a class called Friendly which is a subclass of Character Implement a constructor to fully instantiate the object. Take in a String representing the characters name. This class should always have a max health of 10. – Upon creation “Hi my name is [name] I am friendly!” should be printed. Override and implement the interact abstract method from Character Whenever this class interacts, ” [name]: Hi [other character name] ! should be printed out. – An instance of this class cannot interact with itself. . (15 Friendly (5) Correct constructor -[10] Correct interaction ▶ Character-java Friendlyjava 1 public abstract class Character int health; int maxHealth; String name; // Feel free to add instance variables as you see fit – just don’t remove what’s the 10 public abstract void interact(Character c): 11 12 13 14 15 16 // Define any other abstract or concrete methods here to solve the homework problem. // Remember, anything you put here will be inherited by all subclasses and can be ov / Consider how you can use this to your advantage to store useful information or de 17 public int getHealth) return health; 18 19 20 21 public int getMaxHeaLtho return maxHealth; 24 25 public String getName() return name 26 27 28 29 30 31 private int setMaxHealth(int maxHealth) this.maxHealth = naxHealth; private String setName(String name) this.name name: 34 public int setHealth(int health) this.health health 36 37 38 39 40 41 Show transcribed image text You will be required to design and impiement four other classes to achieve the specifications below. These classes are all concrete, meaning one should be able to create an instance of them. Friendly Character Subclass Create a class called Friendly which is a subclass of Character Implement a constructor to fully instantiate the object. Take in a String representing the characters name. This class should always have a max health of 10. – Upon creation “Hi my name is [name] I am friendly!” should be printed. Override and implement the interact abstract method from Character Whenever this class interacts, ” [name]: Hi [other character name] ! should be printed out. – An instance of this class cannot interact with itself.
. (15 Friendly (5) Correct constructor -[10] Correct interaction
▶ Character-java Friendlyjava 1 public abstract class Character int health; int maxHealth; String name; // Feel free to add instance variables as you see fit – just don’t remove what’s the 10 public abstract void interact(Character c): 11 12 13 14 15 16 // Define any other abstract or concrete methods here to solve the homework problem. // Remember, anything you put here will be inherited by all subclasses and can be ov / Consider how you can use this to your advantage to store useful information or de 17 public int getHealth) return health; 18 19 20 21 public int getMaxHeaLtho return maxHealth; 24 25 public String getName() return name 26 27 28 29 30 31 private int setMaxHealth(int maxHealth) this.maxHealth = naxHealth; private String setName(String name) this.name name: 34 public int setHealth(int health) this.health health 36 37 38 39 40 41

Leave a Reply

Your email address will not be published. Required fields are marked *