QuestionAsk Questions?

Board of Control for Cricket in India wants to award all the best bowlers, based on their performances in a year. A Bowler is called the Best, if the average wickets taken by him during the year is 5 and above. The number of matches played is calculated by the number of digits provided against a player. Assume that no bowler has taken 10 wickets in a match. BCCI has assigned you task to write a program that calculates the count of best bowlers among the given lot. Input/Output Specs Input Specs Your program must read one arguments ( string1) where string1 is a string[] that provides you the input details. String1 is a string array that provides you each player details.

Sample Input: String1 = {â??2210011â??, â??1115422363â??, â??4645637468â??, â??023013â??, â??1323402022â??} Here array represents the number of player information that is provided to you. Considering the 5 players as V. Kumar, R. Ashwin, P. Ojha, V. Aaron, U. Yadav Vinay Kumar has played 7 matches and the performances are 2,2,1,0,0,1,1. The average wickets taken in those 7 matches are 1 wicket per match. Since the criteria are 5, his is not included in the Best Bowlers list. For Ashwin, the number of matches played is 10 and his performances are 1,1,1,5,4,2,2,3,6,3. The average wickets taken per match are 2.8. Since the critera are 5, his is also not included in the list. Similarly for P. Ojha, average wickets taken based on the given details are 5.3. As he fits the criteria of 5 and above, he is included in the Best Bowlers list. For V. Aaron, he doesnâ??t fit the criteria because the average wickets taken by him are only 1.5 For U. Yadav, he also doesnâ??t fit the criteria because the average wickets taken by him are only 1.9 So the total number bowlers who satisfied the criteria for Best Bowler is only one (P.Ojha). So , The output is 1

Coding Specs

class CricketBoard { //method to find the best bowler. public static int findBestBowlers(String [] string1) { int output1 = 0; // Your code here return output1; } public static void main(String [] args) { String [] string1 = new String[5]; //Code here for user input in string1 int result = findBestBowlers( string1); System.out.println(â??No of Best Bowlers : â??+result); } }

View Answers

Related Tutorials/Questions & Answers:

Advertisements