1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
k0ka [10]
4 years ago
10

Imagine you're developing a Pokemon game, and you need to implement the battle party mechanic. Recall that the player's party ca

n 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 containing two keys: "Name" and "Level". The value associated with the key "Name" will be a String denoting the Pokemon's name, and the value associated with the key "Level" will be an Integer denoting the Pokemon's level. 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> as described above HINT: Each Pokemon would be its own HashMap, and each of these HashMaps has exactly two keys, both of which are Strings: "Name" and "Level" 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 Write a program, test using stdin → stdout

Computers and Technology
1 answer:
valina [46]4 years ago
4 0

Answer:

Complete code is given below and output is also attached.

Explanation:

import java.util.ArrayList;

import java.util.HashMap;

import java.util.Iterator;

import java.util.Map;

import java.util.Set;

public class Test {

  public static void main(String[] args) {

      String [] names = {"Pikachu", "Venuasur", "Charizard", "Blastoise", "Lapras", "Sonarlax"};

      int[] levels = {88, 84, 84, 84, 80, 82};

     

      ArrayList<HashMap<String, Integer>> party = createParty(names, levels);

     

      //looping through the list

      for(HashMap<String, Integer> i: party) {

         

          Set set = i.entrySet();

          Iterator itr = set.iterator();

          //showing output

          while(itr.hasNext()) {

              Map.Entry mentry = (Map.Entry)itr.next();

              System.out.println(mentry.getKey()+" "+mentry.getValue());

          }

      }

  }

  private static ArrayList<HashMap<String, Integer>> createParty(String[] names, int[] levels) {

      ArrayList<HashMap<String, Integer>> party = new ArrayList<>();

     

      for(int i=0; i<names.length; i++) {

          //creating new hashmap

          HashMap<String, Integer> pokemon = new HashMap<>();

          pokemon.put(names[i], levels[i]);//adding pokemon

          party.add(pokemon);//adding it to the list

      }

     

      return party;

  }

}

You might be interested in
What is the limitation of computer<br>​
eimsori [14]

The limitation of computer are:

  1. No self-intelligence
  2. No feeling
  3. No learning power
  4. Dependency

3 0
3 years ago
In your own words, describe UML. Identify at least two types of UML diagrams that can be used in software development; describe
lora16 [44]

<u>Uml (Unified Modified Language):</u>

In those days before software development normally we used flow chart, which will have Start, Process, Conditions and Stop, Modified version of flow chart is called UML (Unified Modified Language).

UML is standard model language which help develop understand flow of the software. Uml (Unified Modified Language).

There are 7 type of diagram is used in Uml (Unified Modified Language).

  • Class Diagram.
  • Object Diagram.
  • Component Diagram.
  • Composite Structure Diagram.
  • Deployment Diagram.
  • Package Diagram.
  • Profile Diagram.

I will suggest profile diagram and class diagram.

  • Profile diagram – This diagram is just to define use role and user rights.
  • Class diagram: - This diagram explains the class and their uses in the software development.
7 0
4 years ago
What are the methods or permissions needed to view the passwords for linux and unix?
Greeley [361]
Anybody can read encrypted passwords, they can't decipher them they're encrypted with a one way encryption algorithm.
4 0
4 years ago
What trends do you see in the industry in 2010? For example, if there were more or fewer jobs created by travel and tourism, rep
Setler [38]

Answer:

i saw phones and more social media being used mobile gaming was also invented

Explanation:

me smart birb

4 0
4 years ago
Read 2 more answers
Whats with the bot spamming customer care numbers...kinda annoying when im trying to help people.
Norma-Jean [14]

Answer:

yes

Explanation:

5 0
3 years ago
Other questions:
  • Text filters allow you to create a custom filter to match ________ the text in a field that you specify.
    7·1 answer
  • Describe the 3 parts of a spreadsheet formula
    12·1 answer
  • The keyboard preferences pane includes a list of keyboard shortcuts.
    8·1 answer
  • Convert the following pseudi code to C++ code. BE sure to define the apprpriat evariables.
    9·1 answer
  • This type of software works with end users, application software, and computer hardware to handle the majority of technical deta
    12·1 answer
  • A great way to obtain Hands-On training in a real quick environment is to complete a ??
    12·1 answer
  • Name at least TWO kinds of gaming experiences that are possible with these new control devices but were not possible on original
    7·1 answer
  • A program that doesn’t work properly needs to be debugged. true or false
    8·1 answer
  • Based on the information in the table, which of the following tasks is likely to take the longest amount of time when scaled up
    14·1 answer
  • Jolly 4 pls link in description
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!