jwrbg

asd

Mar 9th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. package ProgrammingBasics;
  2.  
  3. import java.util.Arrays;
  4. import java.util.Scanner;
  5.  
  6. public class AAA {
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.        
  10.  
  11.         int countWin = 0;
  12.         int countDraw = 0;
  13.         int countLoose = 0;
  14.  
  15.         for (int i = 0; i < 3; i++) {
  16.             String result = scanner.nextLine();
  17.             char goalsTeamOne = result.charAt(0);
  18.             char goalsTeamTwo = result.charAt(result.length() - 1);
  19.  
  20.  
  21.             if (goalsTeamOne > goalsTeamTwo) {
  22.                 countWin++;
  23.  
  24.             } else if (goalsTeamOne == goalsTeamTwo) {
  25.                 countDraw++;
  26.             } else if (goalsTeamOne < goalsTeamTwo) {
  27.                 countLoose++;
  28.             }
  29.         }
  30.             System.out.printf("Team won %d games. %n", countWin);
  31.             System.out.printf("Team lost %d games. %n", countLoose);
  32.             System.out.printf("Drawn games: %d", countDraw);
  33.  
  34.  
  35.         }
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment