Question: HOMEWORK 3 C5105 The following is some code designed by J. Hacker for a video game. There is an Alien class to representa monster and

HOMEWORK 3 C5105 The following is some code designed by J. Hacker for a video game. There is an Alien class to representa monster and an AlienPack class that represents a band of aliens and how much damage they can inflict: class Alien { public static final int SNAKE ALIEN = 0; public static final int OGRE ALIEN = 1; public static final int MARSHMALLOW_MAN_ALIEN = 2; public int type, // Stores one of the three above types public int health; // O=dead, 100=full strength public String name; public Alien (int type, int health, String name) this.type = type; this.health = health; this.name = name; public class AlienPack private Alien[] aliens; public Alien Pack (int numAliens) { aliens = new Alien (numAliens); } public void addAlien (Alien newAlien, int index) aliens [index] = newAlien; } public Alien[] getAliens () { return aliens ; } public int calculateDamage () 1 int damage = 0; for (int =0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
