Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class AAAAA {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int maxScore = 0;
- String bestPlayer = "";
- //boolean hatTrick = false;
- String input = scanner.nextLine();
- while (!"END".equals(input)) {
- int goals = Integer.parseInt(scanner.nextLine());
- if (goals > maxScore) {
- maxScore = goals;
- bestPlayer = input;
- }
- if (goals >= 10) {
- break;
- }
- input = scanner.nextLine();
- }
- System.out.printf("%s is the best player!\n", bestPlayer);
- if (maxScore >= 3) {
- System.out.printf("He has scored %d goals and made a hat-trick !!!", maxScore);
- } else {
- System.out.printf("He has scored %d goals.", maxScore);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement