import java.util.ArrayList;import java.util.Collections;import java.util.List;import java.util.Scanner;public class LeadGame {public static void main(String[] args) {Scanner scan = new Scanner(System.in);System.out.println("Enter number of rounds");int rounds = scan.nextInt();List<Integer> score1 = new ArrayList<>();List<Integer> score2 = new ArrayList<>();List<Integer> Leader = new ArrayList<>();List<Integer> Lead = new ArrayList<>();System.out.println("Enter players scores");for (int i = 0; i < rounds; i++) {score1.add(scan.nextInt());score2.add(scan.nextInt());int max = (score1.get(i) > score2.get(i)) ? score1.get(i) :score2.get(i);int min = (score1.get(i) < score2.get(i)) ? score1.get(i) :score2.get(i);int win = (score1.get(i) > score2.get(i)) ? 1 : 2;int lose = (score1.get(i) < score2.get(i)) ? 1 : 2;int lead = max - min;Leader.add(win);Lead.add(lead);
Read more…