Brief:
Sophie is designing a hockey game for two users. Each turn, the users try to score a penalty against each
other. The game has several teams, and each team has a unique name. The teams are stored in an external text
file. Each team consists of six players. The game allows each user to choose one team to play with from the teams stored in the text file. Players may not choose the same team.
Each team player has three attributes:
1. Name.
2. Attack (a number between 0 and 10 inclusive).
3. Defence (a number between 0 and 7 inclusive).
The total of the Attack and Defence values for the whole team must equal 35. For
example, a team of six players with an Attack of 10, and Defence of 0 would break the
rules, as the total would be 60.
User One then selects an Attacker to take a penalty. Each Attacker can only take one
penalty. To score a goal, the following process is used:
1. Calculate the difference between the Attack of the player taking the penalty and the Defence of the goalkeeper.
2. Add a random number between 1 and 4.
3. If the result is negative then the penalty is saved, otherwise it is scored.
Once User One has taken a penalty, User Two then chooses a player to take a penalty, and so on, until all five Attackers have taken penalties. The team with the most goals after all five penalties are taken are the winners, if the scores are equal, then the teams draw.
Design, write, test and refine a program that:
1. Allows a user to create and store the details of a team.
2. Allows the two users to play the game as described above.
3. Adds the result of each game to an external file.
4. Allows the user to enter a team name, and then display the results of that team.
5. Allows the user to display and save a report that displays two leader boards:
other top three teams sorted by number of games won.
other top five teams sorted by the fewest number of goals conceded.