info@meritcampus.com    +91-85006-22255
...

Write a program to get the highest wicket taker in a match. Note that the bowler name is included multiple times in the list if he bowls more than one over. While identifying the highest wickets, we should calculate all the wickets taken by that bowler in multiple overs. Also note that after every six balls the bowler should be changed. Assume that there are no extras like wides, no-balls etc.

Input (List, List) Output (BowlerSummary)
`[2:false, 1:false, 0:false, 0:false, 1:false, 4:false, 0:false, 0:false, 1:false, 3:false, 4:false, 1:false, 0:true, 1:false, 0:true, 6:false, 4:false, 6:false][Kumar, Ahmed, Kumar, Yuvraj, Sharma]` Kumar 2/25
`[0:false, 0:false, 4:false, 4:false, 1:false, 4:false, 0:true, 0:false, 0:true, 6:false, 4:false, 6:false, 0:true, 1:false, 0:true, 6:false, 4:false, 6:false][Sharma, Ahmed, Kumar, Yuvraj]` Ahmed 2/16
`[0:true, 6:false, 4:false, 0:true, 2:false, 0:true, 0:true, 6:false, 4:false, 0:true, 2:false, 0:true][Ashwin, Jadeja, Sharma, Kumar, Ahmed]` Ashwin 3/12

``` class GetHighestWicketTaker {    public static void main(String s[])    {        List ballActivities = new ArrayList();        ballActivities.add(new BallActivity(0, false));        ballActivities.add(new BallActivity(0, false));        ballActivities.add(new BallActivity(0, false));        ballActivities.add(new BallActivity(0, true));        ballActivities.add(new BallActivity(2, false));        ballActivities.add(new BallActivity(1, false));        ballActivities.add(new BallActivity(0, true));        ballActivities.add(new BallActivity(3, false));        ballActivities.add(new BallActivity(4, false));        ballActivities.add(new BallActivity(2, false));        ballActivities.add(new BallActivity(4, false));        ballActivities.add(new BallActivity(0, true));        List batsmanOrder = new ArrayList();        batsmanOrder.add("Kumar");        batsmanOrder.add("Ahmed");        batsmanOrder.add("Kumar");        batsmanOrder.add("Yuvraj");        batsmanOrder.add("Sharma");        BowlerSummary bowlerSummary = getHighestWicketTaker(ballActivities, batsmanOrder);        System.out.println("The Highest Wicket Taker is : " + bowlerSummary);    } private static BowlerSummary getHighestWicketTaker(List<BallActivity> ballActivities, List<String> bowlers) { //Write code here to get the highest wicket taker. } //If required, write any additional methods here. } class BallActivity { int runs; boolean wicket; public BallActivity(int runs, boolean wicket) { this.runs = runs; this.wicket = wicket; } @Override public String toString() { return runs + ":" + wicket; } } class BowlerSummary { String name; int runs; int wickets; public BowlerSummary(String name, int runs, int wickets) { this.name = name; this.runs = runs; this.wickets = wickets; } @Override public String toString() { return name + " " + wickets + "/" + runs; } @Override public boolean equals(Object obj) { BowlerSummary otherBatsmanSummary = (BowlerSummary) obj; return name.equals(otherBatsmanSummary.name) && runs == otherBatsmanSummary.runs && wickets == otherBatsmanSummary.wickets; } } ```
0
Wrong
Score more than 2 points