Advertisement
Kent_St_1

Untitled

Apr 9th, 2020
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class FootballResults_02 {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.         String resultOfTheFirstMatch = scan.nextLine();
  7.         char first = resultOfTheFirstMatch.charAt(0);
  8.         char second = resultOfTheFirstMatch.charAt(2);
  9.         String resultOfTheSecondMatch = scan.nextLine();
  10.         char fst = resultOfTheSecondMatch.charAt(0);
  11.         char sec = resultOfTheSecondMatch.charAt(2);
  12.         String resultOfTheThirdMatch = scan.nextLine();
  13.         char f = resultOfTheThirdMatch.charAt(0);
  14.         char s = resultOfTheThirdMatch.charAt(2);
  15.         int won = 0;
  16.         int lose = 0;
  17.         int drawn = 0;
  18.         if (first > second) {
  19.             won++;
  20.         } else if (first < second) {
  21.             lose++;
  22.         } else {
  23.             drawn++;
  24.         }
  25.         if (fst > sec) {
  26.             won++;
  27.  
  28.         } else if (fst < sec) {
  29.             lose++;
  30.  
  31.         } else {
  32.             drawn++;
  33.  
  34.         }
  35.         if (f > s) {
  36.             won++;
  37.         } else if (f < s) {
  38.             lose++;
  39.  
  40.         } else {
  41.             drawn++;
  42.  
  43.         }
  44.         System.out.printf("Team won %d games.%n", won);
  45.         System.out.printf("Team lost %d games.%n", lose);
  46.         System.out.printf("Drawn games: %d", drawn);
  47.  
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement