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