Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class AAAAA {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7.  
  8.  
  9. int maxScore = 0;
  10. String bestPlayer = "";
  11. //boolean hatTrick = false;
  12. String input = scanner.nextLine();
  13.  
  14. while (!"END".equals(input)) {
  15.  
  16. int goals = Integer.parseInt(scanner.nextLine());
  17.  
  18. if (goals > maxScore) {
  19. maxScore = goals;
  20. bestPlayer = input;
  21. }
  22. if (goals >= 10) {
  23. break;
  24. }
  25. input = scanner.nextLine();
  26.  
  27.  
  28. }
  29. System.out.printf("%s is the best player!\n", bestPlayer);
  30. if (maxScore >= 3) {
  31.  
  32. System.out.printf("He has scored %d goals and made a hat-trick !!!", maxScore);
  33.  
  34.  
  35. } else {
  36.  
  37. System.out.printf("He has scored %d goals.", maxScore);
  38.  
  39.  
  40. }
  41.  
  42.  
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement