Groney

Statistics

Sep 19th, 2018
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.70 KB | None | 0 0
  1. package SelfTestExams;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Statistics {
  6.     public static void main(String[] args) {
  7.         Scanner scan = new Scanner(System.in);
  8.  
  9.         int min = Integer.parseInt(scan.nextLine());
  10.         String player = scan.nextLine();
  11.  
  12.         if (min == 0) {
  13.             System.out.println("Match has just began!");
  14.         } else if (min < 45) {
  15.             System.out.println("First half time.");
  16.         } else {
  17.             System.out.println("Second half time.");
  18.         }
  19.  
  20.         if (min >= 1 && min <= 10) {
  21.             System.out.printf("%s missed a penalty.%n", player);
  22.             if (min % 2 == 0) {
  23.                 System.out.printf("%s was injured after the penalty.%n", player);
  24.             }
  25.         } else if (min > 10 && min <= 35) {
  26.             System.out.printf("%s received yellow card.%n", player);
  27.             if (min % 2 != 0) {
  28.                 System.out.printf("%s got another yellow card.%n", player);
  29.             }
  30.         } else if (min > 35 && min < 45) {
  31.             System.out.printf("%s SCORED A GOAL !!!", player);
  32.         } else if (min > 45 && min <= 55) {
  33.             System.out.printf("%s got a freekick.%n", player);
  34.             if (min % 2 == 0) {
  35.                 System.out.printf("%s missed the freekick.%n", player);
  36.             }
  37.         } else if (min > 55 && min <= 80) {
  38.             System.out.printf("%s missed a shot from corner.%n", player);
  39.             if (min % 2 != 0) {
  40.                 System.out.printf("%s has been changed with another player.%n", player);
  41.             }
  42.         } else if (min > 80 && min <= 90) {
  43.             System.out.printf("%s SCORED A GOAL FROM PENALTY !!!%n", player);
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment