I´ve got this code:
import java.util.HashMap;
public class Main {
public static void main(String[] args) {
HashMap<String, String> mapAtletas = new HashMap<>();
mapAtletas.put("Lionel Messi","Futebol,130");
mapAtletas.put("Lebron James","Basquete,121");
mapAtletas.put("Cristiano Ronaldo","Futebol,115");
mapAtletas.put("Neymar","Futebol,95");
mapAtletas.put("Stephen Curry","Basquete,92");
mapAtletas.put("Kevin Durant","Basquete,92");
mapAtletas.put("Roger Federer","Tênis,90");
mapAtletas.put("Canelo Álvarez","Boxe,90");
mapAtletas.put("Tom Brady","Futebol Americano,83");
mapAtletas.put("Giannis Antetokounmpo","Basquete,80");
mapAtletas.forEach((key, value) -> System.out.println(key + ":" + value));
//Calculate the average by sport
//Show the highest sport average
}
}
How do I do this? Any clue?
I´ve tried to do a split() first to put in array. But how do I get the second value of this array gebnerated?
New contributor
cristfp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.