Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class FootballResults_02 {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String resultOfTheFirstMatch = scan.nextLine();
- char first = resultOfTheFirstMatch.charAt(0);
- char second = resultOfTheFirstMatch.charAt(2);
- String resultOfTheSecondMatch = scan.nextLine();
- char fst = resultOfTheSecondMatch.charAt(0);
- char sec = resultOfTheSecondMatch.charAt(2);
- String resultOfTheThirdMatch = scan.nextLine();
- char f = resultOfTheThirdMatch.charAt(0);
- char s = resultOfTheThirdMatch.charAt(2);
- int won = 0;
- int lose = 0;
- int drawn = 0;
- if (first > second) {
- won++;
- } else if (first < second) {
- lose++;
- } else {
- drawn++;
- }
- if (fst > sec) {
- won++;
- } else if (fst < sec) {
- lose++;
- } else {
- drawn++;
- }
- if (f > s) {
- won++;
- } else if (f < s) {
- lose++;
- } else {
- drawn++;
- }
- System.out.printf("Team won %d games.%n", won);
- System.out.printf("Team lost %d games.%n", lose);
- System.out.printf("Drawn games: %d", drawn);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement