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 minutes = Integer.parseInt(scanner.nextLine());
- String playerName = scanner.nextLine();
- if (minutes == 0) {
- System.out.println("Match has just began!");
- } else if (minutes < 45) {
- System.out.println("First half time.");
- } else {
- System.out.println("Second half time.");
- }
- if (minutes >= 1 && minutes <= 10) {
- System.out.printf("%s missed a penalty.\n", playerName);
- } else if (minutes > 10 && minutes <= 35) {
- System.out.printf("%s received yellow card.\n", playerName);
- } else if (minutes > 35 && minutes < 45) {
- System.out.printf("%s SCORED A GOAL !!!\n", playerName);
- } else if (minutes > 45 && minutes <= 55) {
- System.out.printf("%s got a freekick.\n", playerName);
- } else if (minutes > 55 && minutes <= 80) {
- System.out.printf("%s missed a shot from corner.\n", playerName);
- } else if (minutes > 80 && minutes <= 90) {
- System.out.printf("%s SCORED A GOAL FROM PENALTY !!!\n", playerName);
- }
- if (minutes >= 1 && minutes <= 10 && minutes % 2 == 0) {
- System.out.printf("%s was injured after the penalty.", playerName);
- } else if (minutes > 10 && minutes <= 35 && minutes % 2 != 0) {
- System.out.printf("%s got another yellow card.", playerName);
- } else if (minutes > 45 && minutes <= 55 && minutes % 2 == 0) {
- System.out.printf("%s missed the freekick.", playerName);
- } else if (minutes > 55 && minutes <= 80 && minutes % 2 != 0) {
- System.out.printf("%s has been changed with another player.", playerName);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment