Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ProgrammingBasics;
- import java.util.Scanner;
- public class AAA {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int countWin = 0;
- int countDraw = 0;
- int countLoose = 0;
- for (int i = 0; i < 3; i++) {
- String result = scanner.nextLine();
- char goalsTeamOne = result.charAt(0);
- char goalsTeamTwo = result.charAt(result.length() - 1);
- if (goalsTeamOne > goalsTeamTwo) {
- countWin++;
- } else if (goalsTeamOne == goalsTeamTwo) {
- countDraw++;
- } else if (goalsTeamOne < goalsTeamTwo) {
- countLoose++;
- }
- }
- System.out.printf("Team won %d games.%n", countWin);
- System.out.printf("Team lost %d games.%n", countLoose);
- System.out.printf("Drawn games: %d", countDraw);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement