1) Write a function that reads a file of sports team win/loss records, and computes the win percentage of each. For example, using the file leagueRecords.txt:
Lions, 20, 14
Tigers, 31, 0
Bears, 16, 17
Ohmy's, 11, 5
Ferocious Animals, 12, 8
Home Team Name, 15, 22
Screaming Eagles, 22, 13
Yelling Falcons, 16, 14
Loud-talkin' Bluebirds, 1, 20computeAverages()
Enter name of win/loss file: leagueRecords.txt
Here's the summary report:
The Lions won 58.82% of their games.
The Tigers won 100.00% of their games.
The Bears won 48.48% of their games.
The Ohmy's won 68.75% of their games.
The Ferocious Animals won 60.00% of their games.
The Home Team Name won 40.54% of their games.
The Screaming Eagles won 62.86% of their games.
The Yelling Falcons won 53.33% of their games.
The Loud-talkin' Bluebirds won 4.76% of their games.
Note that the file you read in must be formatted in a particular way. Specifically, each line must contain three items, separated by commas: the team name, the number of wins, and the number of losses. You may assume that whatever file the user types in is formatted in this way. Of course, your program should work for any correctly formatted file, not just the example leagueRecords.txt above.
Notes: - Use string formatting to get the percentages to print as you see above. You are not allowed to use explicit rounding - the rounding should occur entirely through the string formatting functionality. - To get the % symbol to show up, you need to type %% in your string This is because a single % would be interpreted as the string formatting character.