Advertisement
Guest User

MatchStatistics

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