Advertisement
jwrbg

asd

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