Page 1 of 1

You have been given the honorable task of keeping track of the points count in the annual darts competition held in your

Posted: Mon Jun 06, 2022 4:36 pm
by answerhappygod
You have been given the honorable task of keeping track of the
points count in the annual darts competition held in your group of
friends. Because it has unfortunately happened that participants
have tried to cheat themselves to points in previous years, a
completely safe program is needed, which can not be crashed even if
the user completely ignores the instructions and enters the
strangest values. As the weather is not to be trusted, however, the
competition may need to be paused from time to time, so it is of
utmost importance that previously entered results can be read from
a text file and that the program always writes to the same text
file just before the program ends. . Of course, it is also very
important to be able to sort the results so that you can see who is
leading and with what points.
Example of printing:
The annual darts competition is in full swing!
Main menu
1. See result
2. Enter a new result
3. Save and exit
What do you choose? 1
Right now the position is as follows:
Chris 31 points
Ferhat 28 points
Andrèa 8 ​​points
Main menu
1. See result
2. Enter a new result
3. Save and exit
What do you choose? 2
What is the name of the player? Chris
No that name is busy, to avoid confusion enter another. What is the
name of the player? Chris D.
What points did the player get? None at all
That was not a number, please try again. What points did the player
get? 0
Main menu
1. See result
2. Enter a new result
3. Save and exit
What do you choose? 3
The scoreboard is saved. Bye!
Requirements for solution:
Each function must have an explanatory comment where it is also
stated which input parameters the function receives and what it
returns.
No global variables may occur, use parameters and return
values.
The program must be divided into functions according to the
wording. A function must not be longer than 30 lines, then it must
be divided into several functions.
The program should load from a text file once.
The program should write to the same text file once, just before
the program ends.
You should be able to enter new results (names and points).
You should be able to see a sorted scoreboard, where the player
with the highest score is at the top.
Regardless of what the user enters, the program should not crash,
but the user should be given a new chance to enter a real
value.