Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

You are provided with Main.java that is a client for this program. You will create THREE files-- GameCharacter.java, ShieldMaiden.java, and Dragon.java First: You must Create

You are provided with Main.java that is a client for this program.

You will create THREE files-- GameCharacter.java, ShieldMaiden.java, and Dragon.java

First: You must Create an interface called GameCharacter WITH JUST PROTOTYPES, NO IMPLEMENTATIONS

A GameCharacter has a few functions associated with it

1) takeHit: decreases the character's health. It should return an int representing damage taken (hit points)

2) heal: increases the character's health. Should return an int representing amount healed (i.e. hit points)

3) getHealth: returns the total current health the character has (i.e. hit points)

4) isAlive: determines if the character is dead. Should return true if the character is dead, and false if not.

Second: Then create two classes. One should be named Dragon, and the other should be named ShieldMaiden (i.e. warrior) that IMPLEMENT Game Character. Give them each private variables for health. The constructor should take in an initial amount to set health to.

Third: Implement the interface functions for these two classes (Dragon and ShieldMaiden). To make the game more interesting, the dragon's takeHit should hurt the dragon a random number from 10 to 20 inclusive and the ShieldMaiden's takeHit should hurt the shieldMaiden a random number from 15 to 25 inclusive. Furthermore, the dragon's heal should only heal the dragon a random number from 1 to 10 inclusive but the ShieldMaiden's heal should heal the ShieldMaiden a random number from 8 to 20 inclusive. A character is dead when they get negative health.

Fourth: There are unit tests that check for all of these requirements. Try your best to pass all the test cases!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions