Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.lang.reflect.Array;
- import java.util.Scanner;
- public class FootballResults {
- public static void main(String[] args) {
- Scanner myScan = new Scanner(System.in);
- String result;
- int won = 0;
- int lost = 0;
- int draw = 0;
- for (int count = 1; count <= 3; count++) {
- result = myScan.nextLine();
- int teamHome = Integer.parseInt(result.charAt(0) + "");
- int teamAway = Integer.parseInt(result.charAt(2) + "");
- if (teamHome > teamAway) {
- won++;
- } else if (teamHome == teamAway) {
- draw++;
- } else {
- lost++;
- }
- }
- System.out.printf("Team won %d games.\n", won);
- System.out.printf("Team lost %d games.\n", lost);
- System.out.printf("Drawn games: %d", draw);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement