I need help creating an array method for my monster class. The monster is going to have multiple weapons and I need to figure out how to get attack and damage from all of them.
/** * Write a description of class Monster here. * * @author (your name) * @version (a version number or a date) */ import java.util.Random; public class Monster { String name; Backpack pack; public int initiative; public int hitPoints; Purse treasure; Weapon[] monsterWeapons; Armor monsterArmor; public Monster(String name, Backpack pack, int initiative, int hitPoints, Purse treasure, Weapon[] monsterWeapon, Armor monsterArmor){ this.pack=pack; this.initiative=initiative; this.hitPoints=hitPoints; this.treasure=treasure; this.monsterWeapons=monsterWeapons; this.monsterArmor=monsterArmor; } public int rollForInitiative(){ int total=0; Random rand= new Random (); total+=rand.nextInt(20)+1; return total; } public int[] rollWeaponAttacks(){ int total=0; Random rand= new Random (); total+=rand.nextInt(20)+1; return total; } public int[] rollWeaponDamage(){ int total=0; Random rand= new Random (); total+=rand.nextInt(20)+1; return total; } public int takeDamage(int hitPoints){ int total=0; Random rand= new Random (); total+=rand.nextInt(20)+1; return total; } }