Advertisement
finderabc

GameStatistic03( July2018Exam )

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