Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve this as it should generate the expected output. Use java , you can use maps or any suitable data structure.Your program must use a

Solve this as it should generate the expected output. Use java , you can use maps or any suitable data structure.Your program must use a comparable class. Your program can not do a pull value comparison. For example you can't do some like:
if (team1.getValue()< team2.getValue())
Do something
Your program driver class, the class that contains your main, must be called LeagueDriver.java.
Program 1 Tops and Bottoms
You are to write a program that will help the local soccer league. In the league to promote balanced play
teams are put in multiple level brackets and at the end of each season the teams are shifted up if they
are one of the best teams and shifted down if they are one of the worst teams. Your job is to write a
program determines what teams are to be promoted or demoted. The program will rank the teams
based on a specific scoring mechanism. Teams are awarded 3 points if they win a game, 1 point if they
tie a game and 0 points if they lose. In the case of a tie on points the tiebreakers are determined by
goals scored then goals allowed and finally the team number which defines in which order the team
entered the bracket. Your program must utilize your own quick sort algorithm to determine the
promotions and demotions.
Specifications:
Input:
The input will be two files: Teams.txt and Games.txt
teams.txt (two numbers the first being the number of teams and the second being the number of teams
that will be promoted or demoted followed by multiple lines containing the Team Number and Team
Name separated by a comma with a single team on each line)
games.txt (Team1 number (home), Team2 number (away), Team1 score, Team2 score one game on
each line)
Output:
Will be a line stating Promoted followed by single lines of team name and the number of points they
currently have, the number of goals scored and goals allowed. Team name 20 characters left justified,
points 3 characters right justified, goals for 3 characters right justified, goals against 3 characters
right justified
Then a blank line followed by a line stating Religation followed by single lines of team name and the
number of points they currently have, the number of goals scored and goals allowed. Line format same
as Promoted.
Example Input
team.txt
52
1, Mighty Ducks
2, Iron Men
4, Watermarks
5, Henrys Will
8, Chocolate Bar
games.txt
5420
5122
1242
5821
8201
1844
5231
2433
4803
8520
2500
4100
1404
1524
8401
2800
8132
4524
2111
4231
Example Output
Promoted
Henrys Will 171710
Chocolate Bar 111310
Relegation
Mighty Ducks 71520
Iron Men 7914

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions