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

Write a program to print points table of various cricket teams.

Input (List) Printed Output
[India:5:2:2:1:5:0.31, Sri Lanka:5:1:4:0:2:0.32, England:5:1:3:1:3:0.21, Pakistan:5:0:5:0:0:-1.4] `----------------------------------------------Team           M    W    L    T    P     NRR----------------------------------------------India          5    2    2    1    5    +0.310Sri Lanka      5    1    4    0    2    +0.320England        5    1    3    1    3    +0.210Pakistan       5    0    5    0    0    -1.400`
[India:6:6:0:0:9:2.34, Pakistan:6:2:3:1:5:1.2, England:6:4:2:0:8:0.9, Sri Lanka:6:3:2:1:7:-0.12, Australia:6:4:1:1:9:1.6, West Indies:6:2:4:0:4:0.1, South Africa:6:1:5:0:2:-3.5] `----------------------------------------------Team              M    W    L    T    P     NRR----------------------------------------------India             6    6    0    0    9    +2.340Pakistan          6    2    3    1    5    +1.200England           6    4    2    0    8    +0.900Sri Lanka         6    3    2    1    7    -0.120Australia         6    4    1    1    9    +1.600West Indies       6    2    4    0    4    +0.100South Africa      6    1    5    0    2    -3.500`

``` class PrintPointsTable {    public static void main(String s[])    {        List teamPositions = new ArrayList();        teamPositions.add(new TeamPoints("India", 4, 2, 1, 1, 5, 0.45));        teamPositions.add(new TeamPoints("Sri Lanka", 4, 2, 2, 0, 4, 0.32));        teamPositions.add(new TeamPoints("England", 4, 1, 2, 1, 3, 0.21));        teamPositions.add(new TeamPoints("Pakistan", 4, 0, 4, 0, 0, -1.4));        printPointsTable(teamPositions);    } private static void printPointsTable(List<TeamPoints> teamPositions) { //Write code here to calculate batsman strike rate, highest score, average, number of half centuries, number of centuries, number of matches. } //If required, write any additional methods here.. } class TeamPoints { String team; int matches; int won; int loss; int tie; int points; double netRunRate; public TeamPoints(String team, int matches, int won, int loss, int tie, int points, double netRunRate) { super(); this.team = team; this.matches = matches; this.won = won; this.loss = loss; this.tie = tie; this.points = points; this.netRunRate = netRunRate; } @Override public String toString() { return "[" + team + ":" + matches + ":" + won + ":" + loss + ":" + tie + ":" + points + ":" + netRunRate + "]"; } } ```

Topic: Number Format

0
Wrong
Score more than 2 points