Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int won = 0, lost = 0, drawn = 0,
- teamOneResult, teamTwoResult;
- String gameResult;
- for (int i = 0; i < 3; i++) {
- gameResult = scanner.nextLine();
- teamOneResult = gameResult.charAt(0);
- teamTwoResult = gameResult.charAt(2);
- if (teamOneResult > teamTwoResult) {
- won++;
- } else if (teamTwoResult > teamOneResult) {
- lost++;
- } else {
- drawn++;
- }
- }
- System.out.println(
- "Team won " + won + " games.\n"
- + "Team lost " + lost + " games.\n"
- + "Drawn games: " + drawn + "\n"
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement