0

how to solve it Bowling Game it will show always error

mport java.util.*; public class Bowling { HashMap<String, Integer> players; Bowling() { players = new HashMap<String, Integer>(); } public void addPlayer(String name, int p) { players.put(name, p); } //your code goes here public void getWinner(){ int maxvalue=(Collections.max(players.values())); for(Map.Entry<String, Integer>entry : players.Entryset()){ if(entry.getvalue()==maxValueInMap); { System.out.println(entry.getkey()); } } } } public class Program { public static void main(String[ ] args) { Bowling game = new Bowling(); Scanner sc = new Scanner(System.in); for(int i=0;i<3;i++) { String input = sc.nextLine(); String[] values = input.split(" "); String name = values[0]; int points = Integer.parseInt(values[1]); game.addPlayer(name, points); } game.getWinner(); } }

18th Oct 2021, 11:36 AM
Prabhat
1 Antwort
+ 1
Writing code inside question description doesn't help much. Better practice is to copy this code into Sololearn code editor, save and share link in description.
21st Oct 2021, 5:35 AM
Grzegorz Sikorski
Grzegorz Sikorski - avatar