AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
3. Our Experts are looking for yours ?.

# corejava-programming: Java Program of Premier League

 It is a league in which twenty teams compete for over nine months while playing 38 matches against each other. The team with max points wins the league and Manchester united have won the most number of premier league titles. So Basically A Team With Max Points Wins The League But What If Two Teams Have The Same Number Of Points? Premier League authority need your help for building a Java application for this problem. Input Format : (Assume Top 5 Teams) First line will be the season. Remaining five line will contain following: Team_Name Total_Matches Wins Draws Losses Goals_Scored Goals_Conceded Goal_Difference Tips: 1 Win Equals 3 Points 1 Draw Equals 1 Points 1 Loss Equal 0 Points Sample Input : Season 2011-12 Chelsea 38 18 10 10 65 46 +19 Manchester_United 38 28 5 5 89 33 +56 Arsenal 38 21 7 10 74 49 +25 Tottenham_Hotspur 38 20 9 9 66 41 +25 Manchester_City 38 28 5 5 93 29 +64 Sample Output : Manchester_City Are The Champions Of Season 2011-12! Explanation: Manchester United & Manchester City Had The Same Number Of Points i.e. 89 (Wins * 3 + Draw * 1 + Loss * 0) But Since Manchester City Had The Greater Goal Difference (64 > 56) They Where Crowned Champions. corejava x 353programming x 168 Posted On : 2018-01-26 20:57:07.0 Xda Coder 1300 4

 import java.util.Scanner; public class WinnerFinder { public static void main(String[] args) { Scanner input=new Scanner(System.in); String seasonName=input.nextLine().trim(); String winner=null; int maxPoints=0; int maxGoalDiff=0; int points=0; int goalDiff=0; String[] temp=null; for(int i=1;i<=5;i++){ temp=input.nextLine().trim().split(" "); points=Integer.valueOf(temp[2])*3+Integer.valueOf(temp[3]); goalDiff=Integer.valueOf(temp[7].substring(1)); if(points>maxPoints){ winner=temp[0]; maxPoints=points; maxGoalDiff=goalDiff; }else if(points==maxPoints && maxGoalDiff
Code is lacking match draw condition
Xda Coder
13  0  0
Posted On :2018-01-29 20:33:04.0
I think, it is already there.. give me that test case with input data. I´ll check.
Rishi Kumar
523  1882  22642
Posted On :2018-01-29 21:21:53.0
Change this statement points=Integer.valueOf(temp[2])*3+Integer.valueOf(temp[2]);
to points=Integer.valueOf(temp[2])*3+Integer.valueOf(temp[3]);
sivasurya
0  0  0
Posted On :2018-01-31 11:37:22.0