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