Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Exam;
- import javafx.scene.control.skin.CellSkinBase;
- import java.util.Scanner;
- public class ex5 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String name = scanner.nextLine();
- int goals = Integer.parseInt(scanner.nextLine());
- int max = Integer.MIN_VALUE;
- while (!name.equals("END")){
- name = scanner.nextLine();
- goals = Integer.parseInt(scanner.nextLine());
- if(goals > max) {
- max = goals;
- if(goals < 3){
- System.out.printf("%s is the best player!\n", name);
- System.out.printf("He has scored %d goals.\n", max);
- } else if(goals >= 3 && goals >= 10){
- System.out.printf("%s is the best player!\n", name);
- System.out.printf("He has scored %d goals and made a hat-trick !!!\n", max);
- break;
- }
- }
- }
- //На конзолата да се отпечатат 2 реда :
- //• На първия ред:
- // "{име на играч} is the best player!"
- //• На втория ред :
- //o Ако най-добрият футболист е направил хет-трик:
- // "He has scored {брой голове} goals and made a hat-trick !!!"
- //o Ако най-добрият футболист НЕ е направил хет-трик:
- // "He has scored {брой голове} goals."
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement