You have been asked to create a program to keep track of the scores from the football Premier League.
Your program will store match results in a text file using the following format:
For instance, after a few games your text file may contain the following information:
Crystal Palace;Swansea City;0;2;
Newcastle United;West Ham United;3;0;
Manchester United;Leicester City;2;0;
Swansea City;Manchester United;0;4;
To complete this challenge you will need to read more about how to read through a CSV file.
Your program should include:
- An option to input and append a new line / match score to the text file. To do so the program will:
- Ask the user to input the name of the Home team,
- Ask the user to input the name of the Away team,
- Ask the user to input the Home Score (number of goals scored by the home team.),
- Ask the user to input the Away Score (number of goals scored by the away team.),
- Append all this information at the end of the text file.
Create another option where the program will:
- Ask the user to display all the scores on screen using the following format:
Create a third option where the program will:
- Allow the user to enter a team name to display all the results of this team.
- Calculate and display the number of points of a team; knowing that a team scores 3 points for a win, 1 point for a draw and 0 point for a loss.
Top-Down Modular Design
This diagram represents the main components of our system:
We have started the code for you by implementing a basic menu structure. You task is to implement the code for each one of the three options: