Edzhevit

GameStatistics

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