Write a program to calculate the run rate and the score at the end of the each over. Note that there can be extras like no balls, wides and leg byes.

Input (List) Output (List)
[2FFT, 1FFF, 1FTF, 1FTF, 0FFF, 0FFF, 1FFF, 4FFF, 1FTF, 0FFF, 1FTF, 0FFF, 1FFF, 3FFT, 1FTF, 4FFF, 1FFF, 0TFF, 1FTF, 1FTF, 1FFF, 0TFF, 2FTF, 2FFT, 4FFF, 6FFF] [10(1) RR:10.0, 22(2) RR:11.0, 39(3) RR:13.0]
[0FFF, 0FFF, 4FFF, 4FFF, 1FFF, 4FFF, 0TFF, 0FFF, 0TFF, 6FFF, 4FFT, 6FFF, 0TFF, 1FFF, 0TFF, 6FFF, 4FFT, 6FFF] [13(1) RR:13.0, 29(2) RR:14.5, 46(3) RR:15.333333333333334]
[0FFF, 0FFF, 1FTF, 0FFF, 0TFF, 6FF, 2FTF, 6FFF, 0TFF, 1FTF, 4FFT, 4FFF, 1FTF, 4FFT, 4FFF, 1FTF, 1FTF, 0TFF] [15(1) RR:15.0, 35(2) RR:17.5]

``` class GetRunRateOfEachOverWithExtras {    public static void main(String s[])    {        List ballActivities = new ArrayList();        ballActivities.add(new BallActivity(0, false, false, false));        ballActivities.add(new BallActivity(0, false, false, false));        ballActivities.add(new BallActivity(0, false, false, false));        ballActivities.add(new BallActivity(0, true, false, false));        ballActivities.add(new BallActivity(1, false, false, false));        ballActivities.add(new BallActivity(2, false, true, false));        ballActivities.add(new BallActivity(2, false, false, false));        ballActivities.add(new BallActivity(0, true, false, false));        ballActivities.add(new BallActivity(3, false, false, false));        ballActivities.add(new BallActivity(4, false, false, false));        ballActivities.add(new BallActivity(4, false, false, true));        ballActivities.add(new BallActivity(2, false, false, false));        ballActivities.add(new BallActivity(1, false, true, false));        ballActivities.add(new BallActivity(0, true, false, false));        System.out.println("The run rates and scores at the end of each over are : ");        System.out.println(getOverDetails(ballActivities));    } private static List<OverDetails> getOverDetails(List<BallActivity> ballActivities) { //Write code here to calculate the run rate and the score at the end of each over } } class BallActivity { int runs; boolean wicket; boolean noBallOrWide; boolean legBye; public BallActivity(int runs, boolean wicket, boolean noBallOrWide, boolean legBye) { this.runs = runs; this.wicket = wicket; this.noBallOrWide = noBallOrWide; this.legBye = legBye; } @Override public String toString() { return runs + (wicket ? "T" : "F") + (noBallOrWide ? "T" : "F") + (legBye ? "T" : "F"); } } class OverDetails { int over; double runRate; int totalScore; public OverDetails(int over, double runRate, int totalScore) { this.over = over; this.runRate = runRate; this.totalScore = totalScore; } @Override public boolean equals(Object obj) { OverDetails other = (OverDetails) obj; return over == other.over && runRate == other.runRate && totalScore == other.totalScore; } @Override public String toString() { return totalScore + "(" + over + ")" + " RR:" + runRate; } } ```