Question
Imagine you're developing a Pokemon game, and you need to implement the battle party mechanic. Recall that the player's party can hold at most 6
Imagine you're developing a Pokemon game, and you need to implement the battle party mechanic. Recall that the player's party can hold at most 6 Pokemon. To simplify things, you want to implement it as an ArrayList containing 6 elements (1 for each Pokemon in the party), and to simplify things even further, you decide to avoid making a custom Pokemon class. Instead, you choose to represent each Pokemon as a HashMap
TASK: Write a public static method called createParty that has one parameter of type String[] called names containing the Pokemon names, followed by a parameter of type int[] called levels containing the Pokemon levels (where names[i] and levels[i] are the name and level of Pokemon i in the party). It should return the party as a ArrayList
HINT: Each Pokemon would be its own HashMap
Sample Input:
Pikachu Venusaur Charizard Blastoise Lapras Snorlax 88 84 84 84 80 82
Sample Output:
Pikachu 88 Venusaur 84 Charizard 84 Blastoise 84 Lapras 80 Snorlax 82
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