Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class GameStatistics {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int min = Integer.parseInt(scanner.nextLine());
- String namePlayer = scanner.nextLine();
- if (min == 0) {
- System.out.println("Match has just began!");
- } else if (min < 45) {
- System.out.println("First half time.");
- if (min <= 10) {
- System.out.printf("%s missed a penalty.%n", namePlayer);
- if (min % 2 == 0) {
- System.out.printf("%s was injured after the penalty.", namePlayer);
- }
- } else if (min <= 35) {
- System.out.printf("%s received yellow card.%n", namePlayer);
- if (min % 2 != 0) {
- System.out.printf("%s got another yellow card.", namePlayer);
- }
- } else {
- System.out.printf("%s SCORED A GOAL !!!", namePlayer);
- }
- } else {
- System.out.println("Second half time.");
- if (min <= 55 && min > 45) {
- System.out.printf("%s got a freekick.%n", namePlayer);
- if (min % 2 == 0) {
- System.out.printf("%s missed the freekick.", namePlayer);
- }
- } else if (min <= 80 && min > 55) {
- System.out.printf("%s missed a shot from corner.%n", namePlayer);
- if (min % 2 != 0) {
- System.out.printf("%s has been changed with another player.", namePlayer);
- }
- } else if (min > 80) {
- System.out.printf("%s SCORED A GOAL FROM PENALTY !!!", namePlayer);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement