Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use java, i have created a character class and associated getter and setters, create a Friendly subclass: feel free to add to the interact abstract

use java, i have created a character class and associated getter and setters, create a Friendly subclass:
feel free to add to the interact abstract class: image text in transcribed
image text in transcribed
charcter.java:
image text in transcribed
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

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

More Books

Students also viewed these Databases questions