0
We are going to write a program that will calculate the area of a circle. The area enclosed by a circle of radius r is πr², w
Please any help
5 ответов
+ 4
Post your code please
+ 2
Can anybody help me to debug and fix the error of this code
+ 1
import 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(){
HashMap<String, Integer> hm = new HashMap<String, Integer>();
Map.Entry<String, Integer> entryWithMaxValue = null;
for (Map.Entry<String, Integer> currentEntry : hm.entrySet()) {
if (entryWithMaxValue == null || currentEntry.getValue().compareTo(entryWithMaxValue.getValue()) > 0) {
entryWithMaxValue = currentEntry;
}
}
System.out.println(entryWithMaxValue.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();
}
}
+ 1
It's just remove the above text
+ 1
Thanks