Print over summary showing the number of runs wickets and the extras - Java Quiz Question



Write a program to print over summary showing the number of runs, wickets and the extras. Delimit the overs using the pipe (|).

Input (List) Printed Output
[0FFFFF, 0FFFFF, 2FFFFF, 0FFFFF, 0FFFFF, 0FFFFF, 2FFFFF, 1FFFFF, 2FFFFF, 1FFTFF, 0TFFFF, 1FFFFT, 4FFFTF, 1FFFFF, 1FFFFF, 1FFFFF, 1FFFFF, 4FFFFF, 1FFFFF, 0TFFFF, 0FFFFF, 2FTFFF, 6FFFFF, 0TFFFF, 0FFFFF, 6FFFFF] . . 2 . . . | 2 1 2 1wd W 1b 4lb | 1 1 1 1 4 1 | W . 2nb 6 W . 6
[1FFFFF, 1FFFFF, 1FFFFF, 1FFFFF, 4FFFFF, 1FFFFF, 0FFFFF, 1FFFFF, 1FFFFF, 1FFFFF, 0FFFFF, 4FFFFF] 1 1 1 1 4 1 | . 1 1 1 . 4

class PrintOverSummary

{    public static void main(String s[])
    {
        List ballActivities = new ArrayList();
        ballActivities.add(new BallActivity(1, false, false, false, false, false));
        ballActivities.add(new BallActivity(0, false, false, false, false, false));
        ballActivities.add(new BallActivity(0, false, false, false, false, false));
        ballActivities.add(new BallActivity(0, false, false, false, false, false));
        ballActivities.add(new BallActivity(1, false, false, false, false, false));
        ballActivities.add(new BallActivity(1, false, false, false, false, false));
        ballActivities.add(new BallActivity(4, false, false, false, false, false));
        ballActivities.add(new BallActivity(4, false, false, false, false, false));
        ballActivities.add(new BallActivity(1, false, false, false, false, false));
        ballActivities.add(new BallActivity(1, false, false, false, false, false));
        ballActivities.add(new BallActivity(1, false, false, false, false, false));
        ballActivities.add(new BallActivity(1, false, false, true, false, false));
        ballActivities.add(new BallActivity(1, false, false, false, false, false));
        ballActivities.add(new BallActivity(0, false, false, false, false, false));
        ballActivities.add(new BallActivity(1, false, false, false, false, false));
        ballActivities.add(new BallActivity(2, false, false, false, false, false));
        ballActivities.add(new BallActivity(0, false, false, false, false, false));
        ballActivities.add(new BallActivity(1, false, false, false, false, false));
        ballActivities.add(new BallActivity(1, false, false, false, false, false));
        printOverSummary(ballActivities);

    }


private static void printOverSummary(List<BallActivity> ballActivities) {
//Write code here to print the over summary.
}
}
class BallActivity {

int runs;
boolean wicket;
boolean noBall;
boolean wide;
boolean legBye;
boolean bye;

public BallActivity(int runs, boolean wicket, boolean noBall, boolean wide, boolean legBye, boolean bye) {
this.runs = runs;
this.wicket = wicket;
this.noBall = noBall;
this.legBye = legBye;
this.wide = wide;
this.bye = bye;
}

@Override
public String toString() {
return runs + (wicket ? "T" : "F") + (noBall ? "T" : "F") + (wide ? "T" : "F") + (legBye ? "T" : "F") + (bye ? "T" : "F");
}
}