Advertisement
yovkovbpfps

If Else Game Statistics

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