Question: public void setChoice 1 ( Hero _ CZ 9 7 3 9 1 4 [ ] heroes ) { / / function to Show all

public void setChoice1(Hero_CZ973914[] heroes){//function to Show all characters by alphabetical ordered
Hero_CZ973914 myFile = new Hero_CZ973914(); myFile.getName().compareTo(Hero_CZ973914.length()); for (Hero_CZ973914 myFile1 : heroes){ System.out.println(myFile1); }
} public void setChoice2(Hero_CZ973914[] heroes, String attackAbility){// function to Find characters with attack ability
for (Hero_CZ973914 myFile : heroes){ if (myFile.getAttackAbility().equalsIgnoreCase(attackAbility)){ System.out.println(myFile); }}
} public void setChoice3(Hero_CZ973914[] heroes){// function to Sort characters by high-to-low power
Hero_CZ973914 myFile = new Hero_CZ973914(); myFile.getPower(); for (Hero_CZ973914 myFile1 : heroes){ System.out.println(myFile1); }
}
public void setChoice4(Hero_CZ973914[] heroes){// function to calculate the total power from all power
totalPower =0; for (Hero_CZ973914 myFile : heroes){ totalPower += myFile.getPower(); return;//returns the total power }
} public void setChoice2list(){//function list for choice 2 System.out.println(1. Cybernetic); System.out.println(2. Pyrotechnic); System.out.println(3. StrengthGrowth); System.out.println(4. HostileBoost); }} Program four separate methods that implement the following: Show the list on the screen sorted alphabetically by the names. Find and show all characters with a specified attack ability. Show the list on the screen sorted from the lowest to the highest characters power. Calculate the total power of all characters. For each method decide what are methods parameters to receive and process and what is the returning value if any. IMPORTANT: Methods should not change the original array received from the file in any way.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!