Write a program to print the runs per over chart using ball numbers as shown below. The runs per ball in every over is given.
Input (int[]) | Printed Output |
---|---|
{{0, 1, 3, 1, 0, 2}, {4, 4, 0, 6, 1, 2}, {0, 5, 6, 4, 3, 2}, {1, 3, 4, 6, 1, 2}, {4, 6, 4, 4, 6, 2}, {4, 2, 6, 1, 3, 2}} | 6 |
{{0, 1, 3, 1, 0, 2}, {0, 2, 0, 1, 3, 0}, {3, 0, 0, 4, 2, 0}} | 5 |
{{4, 0, 2, 1, 6, 6}, {3, 4, 2, 2, 6, 6}, {0, 1, 4, 2, 2, 2}, {6, 4, 2, 1, 6, 2}, {0, 1, 2, 4, 6, 2}, {4, 4, 3, 2, 1, 0}, {3, 1, 4, 6, 2, 1}, {1, 4, 6, 2, 3, 1}, {6, 1, 2, 3, 4, 1}} | 6 |
{{1, 0, 2, 4, 6, 2}, {2, 3, 4, 1, 2, 1}, {6, 2, 4, 1, 2, 4}, {6, 1, 3, 2, 1, 4}} | 6 |
class PrintRunsPerOverChartAdvanced
{ public static void main(String s[])
{
int[][] input = {{0, 1, 3, 1, 0, 2}, {4, 4, 0, 6, 1, 2}, {0, 5, 6, 4, 3, 2}, {1, 3, 4, 6, 1, 2}, {4, 6, 4, 4, 6, 2}, {4, 2, 6, 1, 3, 2}};
printChart(input);
}
public static void printChart(int[][] allOvers) {
//Write code here to print runs per over using numbers
}
//Write any additional methods if required
}
Topic: Learn Arrays And Loops