I need to write a Java program using an input file with the below data. I don’t even know where to begin. I have written others but this one has me totally confused. I know how to do it using math WL% = Wins / (Wins + Losses)
I also wrote this to use but, can’t figure out how to apply it
Private void Calculate WinPercent ()
{
If (wins+losses)==0)
WinPercent =0.0
Else
Winpercent =(double)wins/wins(wins+losses)*100
}
The program has to do this:
1. Process all data until it reaches the end-of-file. Calculate the win percentage for each team.
2. Output to a file ("top.txt") a listing of all teams with a win percentage greater than .500. This file should contain the team name and the win percentage.
3. Output to a file ("bottom.txt") a listing of all teams with a win percentage of .500 or lower. This file should contain the team name and the win percentage.
4. Count and print to the screen the number of teams with a record greater then .500 and the number of teams with a record of .500 and below, each appropriately labeled.
5. Output in a message box: the team with the highest win percentage and the team with the lowest win percentage, each appropriately labeled. If there is a tie for the highest win percentage or a tie for the lowest win percentage, you must output all of the teams.
Dallas 5 2
Philadelphia 4 3
Washington 3 4
NY_Giants 3 4
Minnesota 6 1
Green_Bay 3 4