galinyotsev123

ProgBasicsExam28and29July2018-E03gameStatistics

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