tital warriors from different races, each with its own attack power and health. Accomplish the following tasks: Display all warriors in the list. Identify and display warriors from the elven race. Calculate the average health of all warriors. Create a frequency distribution of warrior classes in the list. Each element in the distribution should represent the count of warriors belonging to a specific class. Store all the warriors in a Java HashMap, using their names as keys. Output the names of warriors with an attack power above a certain threshold (e.g., attack power > 50). Output the total number of entries in your HashMap. Warriors.txt: "Legolas", Elf, Archer, 80, 120 'Gimli", Dwarf, Warrior, 70, 100 'Aragorn", Human, Swordsman, 90, 150 'Tauriel", Elf, Archer, 75, 110 'Gandalf", Wizard, Sorcerer, 95, 130 "Sauron", Orc, Warlord, 85, 200 "Frodo", Hobbit, Thief, 60, 80

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question
You guys use AI tool to answer. Last time I found plagiarism and AI detection in my answer. Now If you will use these things I'll surely give multiple downvotes and will report ⚠️ sure.
a program Java that simulates a fantasy battle scenario. You have a list of
warriors from different races, each with its own attack power and health. Accomplish
the following tasks:
Display all warriors in the list.
Identify and display warriors from the elven race.
Calculate the average health of all warriors.
Create a frequency distribution of warrior classes in the list. Each element in the
distribution should represent the count of warriors belonging to a specific class.
Store all the warriors in a Java HashMap, using their names as keys.
Output the names of warriors with an attack power above a certain threshold (e.g.,
attack power > 50).
Output the total number of entries in your HashMap.
Warriors.txt:
"Legolas", Elf, Archer, 80, 120
"Gimli", Dwarf, Warrior, 70, 100
"Aragorn", Human, Swordsman, 90, 150
"Tauriel", Elf, Archer, 75, 110
"Gandalf", Wizard, Sorcerer, 95, 130
"Sauron", Orc, Warlord, 85, 200
"Frodo", Hobbit, Thief, 60, 80
Transcribed Image Text:a program Java that simulates a fantasy battle scenario. You have a list of warriors from different races, each with its own attack power and health. Accomplish the following tasks: Display all warriors in the list. Identify and display warriors from the elven race. Calculate the average health of all warriors. Create a frequency distribution of warrior classes in the list. Each element in the distribution should represent the count of warriors belonging to a specific class. Store all the warriors in a Java HashMap, using their names as keys. Output the names of warriors with an attack power above a certain threshold (e.g., attack power > 50). Output the total number of entries in your HashMap. Warriors.txt: "Legolas", Elf, Archer, 80, 120 "Gimli", Dwarf, Warrior, 70, 100 "Aragorn", Human, Swordsman, 90, 150 "Tauriel", Elf, Archer, 75, 110 "Gandalf", Wizard, Sorcerer, 95, 130 "Sauron", Orc, Warlord, 85, 200 "Frodo", Hobbit, Thief, 60, 80
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Map
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT