Question
TASKS: Your program will read two data files, set up in the same folder as was done for the first assignment. These data files are
TASKS: Your program will read two data files, set up in the same folder as was done for the first assignment. These data files are called team.dat and match.dat. You program should have the following steps: 1. Read the national football team names and the group they belong to from the first data file and store them (wherever your program design says it is best to do so). There will be 32 names, and each group contain 4 teams. You may then close the first file. You may assume that this first data file does not contain any errors at all. The file contains the team names ordered per group. 2. Read the second data file, reading and processing one data set at a time, stopping at end-offile. The second data file will contain data for all the games played during the current time period. Each data set in this file will consist of a result for an individual game, and will consist of 2 team names, each followed by a number of goals (that is, each data set will have the form: first_team first_score second_team second_score). It will also be possible for this file to be empty. 3. For each data set, check for data consistency. If any data item is negative the data set is invalid. Any invalid data set is reported with an error message and ignored. E.g. Colombia 3 Poland -1 data is invalid 4. For each data set, find the correct teams name in your data structure. If the teams name cannot be found, including matching exactly by case, then the data is also invalid, whereupon it is reported as such, and then ignored. E.g. Columbia 2 Japan 1 name not found in team list australia 1 France 1 name not found in team list 5. Once the data set is valid, for each match, you will need to record the result for each team (that is the win for one team and the loss for the other, or a draw for both of them), and the goals counters. This will involve updating the data values for the respective teams. You will need to search for the names of the teams and record the respective result for each team. 6. Produce a by performance by group decreasing ordered list of the teams as per required table of reporting (below). Use an output format that will left-justify the name. This should be reasonably simple since the team names were originally input in by group order. 7. Produce (sort) an alphabetically ordered list of the teams and their performances as per required table of reporting (below). Use an output format that will left-justify the name. 8. Produce (sort) a list of teams by decreasing order of team performance as per required table of reporting (below). This will be a challenging task think carefully about how you will compare the ranking of any two teams this becomes the basis for sorting
The soccer national teams within the group are ranked, initially, according to this given points; however, in some cases there could be ties. When there is a tied position, this one is solved as per the following criteria: 1. Team with the greatest goal difference in all group matches gets the position. 2. Team with the greatest combined number of goals scored in all group matches gets the position
team.dat
Russia A
SaudiArabia A
Egypt A
Uruguay A
Portugal B
Spain B
Morocco B
Iran B
France C
Australia C
Peru C
Denmark C
Argentina D
Iceland D
Croatia D
Nigeria D
Brazil E
Switzerland E
CostaRica E
Serbia E
Germany F
Mexico F
Sweden F
SouthKorea F
Belgium G
Panama G
Tunisia G
England G
Poland H
Senegal H
Colombia H
Japan H
match.dat
Russia 2 SaudiArabia 1
Morocco 1 Iran 1
France 2 Australia 0
Argentina -2 Iceland 0
CostaRica 1 Serbia 1
Germany 1 Mexico 0
Belgium 2 Panama 2
Colombia 2 Japan 1
Egypt 1 Uruguay 2
Portugal 1 Spain 1
Peru 2 Denmark 2
croatia 0 Nigeria 0
Brazil 3 Switzerland 1
Sweden 1 SouthKorea -2
Tunisia 1 England 3
Poland 1 Senegal 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started