Question
JAVA In this game you will have two tanks. Each tank will start a random distance apart. Each tank will take turns firing at the
JAVA
In this game you will have two tanks. Each tank will start a random distance apart. Each tank will take turns firing at the other until one has been eliminated. You will need to create classes for the tank, the game and the main. The tank class should have a method to fire and to take damage as well as a method to report the hit points left. It does not have to move. The game class should contain two instances of the tank class as well as any other variables needed to play the game. The game class will call the fire method from one tank and pass it on to the other tank as damage. You will also need a method in the game class to decide if one tank has been eliminated. You will need additional methods in the game class to play a round and to play the game. Use the following code to finish.
----------------------------------------------------------------------------------------------------------------------------------------------------------
package heroes_and_monsters;
public interface Dungeon_CharacterI {
public int get_current_hp();
public int get_max_hp();
public String get_name();
public int get_num_turns(int opponent_attack_speed);
public void set_hp (int hp_in);
public void set_max_hp(int hp_in);
public void set_damage_max(int damage_in);
public int get_damage_max();
public void set_attack_speed(int attack_speed_in);
public int get_attack_speed();
public void set_chance_to_hit(double chance_to_hit_in);
public double get_chance_to_hit();
public boolean successful_action(double chance_in);
public int attack();
public boolean is_alive();
public void show_info();
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started