You are on page 1of 6

Soccer League Management Software Specification

By: Elias Besculides and Ryan Stewart

First View → Browsing View

User Interface:

____________________________________________________________
____
2019 Season: Browsing View
-------
Player (3/19):
Name: Ryan Stewart
Birth Year: 2010
League: U10
Paid: Yes
------------------------------------------------------------------------------------------------------------------
Type ‘help’ to get a list of commands
>>
____________________________________________________________
____

____________________________________________________________
____
2019 Season: Browsing View
-------
Player (14/19):
Name: Alexis Maciel
Birth Year: 2011
League: U10
Paid: No

------------------------------------------------------------------------------------------------------------------
Type ‘help’ to get a list of commands
>>help
Commands:
* search - searches for a player
* new_season - starts a new season and discards the current one
>>
____________________________________________________________
____

Start of Program:
● Read Existing Information from a file if one exists:
○ Open the season
○ Create a new season → Browsing View only
○ Stop program
● Else if there is no file
○ Ask the user to start a new season

● Within a season:
○ Display Available Leagues
○ Displays Commands
○ Add a player
○ Edit player info
○ Delete a player
○ Display statistics
○ Move to next or previous player
○ Print a list of players
○ Search players → Enters Search View
○ Stop program

Browsing View:
● Create a new season
● Display statistics

Search View:
● Exit search view
● Print a list of players
● Stop Program

Commands:
● Print Players​ - Asks the user for the name of a file and writes players to that file. In the
search results view, only the players produced by the last search are written to the file. In
the browsing view, players are written by league. They are written in alphabetical order.
● Start New Season​ - User provides a year and the program deletes all existing players in
that season. Before deleting, the program asks for a confirmation.
● Add Player​ - User provides name, year of birth, and registration status. Should place
player in the appropriate league based on their year of birth. If the player’s age (season
year minus year of birth) is less than 4 or greater than 16, inform the user they are not
allowed to play.
● Edit Player​ - Edits current player. User may change the name, year of birth and
registration status of the player. League is recomputed automatically.
● Delete Player​ - Deletes the current player. Before deleting, the program asks for a
confirmation. (Should run in logarithmic time)
● Next / Previous Player​ -
○ These work in alphabetical order.
○ They’re circular: From the last player, next moves to the first player: From the first
player, previous moves to the last player.
● Display Statistics​ - Displays the total number of players, the number who have paid and
the number who haven’t paid, in total and for each League. Available only in the
browsing view.
● Search for Players​ - The user provides any combination of last name, first name, year of
birth, registration status and category. The program searches for matching players and
enters the search results view. If no matching players are found, a message is printed
and the program remains in whatever view it was in. In the search results view, the
program searches all the players, not just those being displayed
● Exit the search results view​ - Returns the program to the browsing view.
● Stop the program​ - Any changes to the list of players are saved for the next session.
Soccer League Management Software Design
By: Elias Besculides and Ryan Stewart

UI → Class:
● Public:
○ Function bool exec_command(const string & command, bool & done): This
executes commands given to it and calls many other helper functions in order to
do its task. This function contains the help menu as well. This function dets the
boolean done when it should notify run that it should stop trying to execute
commands. The boolean this function returns is used to tell whether a command
can be successfully executed or not
○ Function void display(): This displays the UI menu after a majority of the
commands have been run.
○ Function void start(): This is what’s called when the program first starts. Main
should call this function and from here this will make sure that the season file can
be loaded, or ask the user whether they’d like to start a new season or not.
○ Function void run(): This function is called from start. This is what called
exec_command and gets the input from the user to pass to it.
● Private:
○ Boolean is_browsing_: this is used to tell which state the user interface is in. If
true, it’s browsing, if false, it’s searching.
○ Function bool check_paid(const string & input, bool & paid): This takes in a string
and checks to see if it is ‘yes’, ‘y’, ‘no’ or ‘n’ in any character case and then sets
the paid boolean based upon that. This function returns a boolean to say whether
the input was actually any of those specified above.
○ Function void get_player_details(string & name, int & year, bool & paid): A helper
function that takes the inputs and modifies them based on if they meet the
requirements needed.
○ Function void search(): Creates the UI for players to search for specific
parameters. This then asks the season to search for the players.
○ Function void new_season(): Self explanatory
○ Season season_: A season class where anything related to the season and
players is asked here.

Player → Struct:
● String first
● String last
● Int year
● Boolean paid

Stat → Struct:
● String league
● Int players
● Int paid
● Int not_paid

Player Map → Map:


● String key: Player’s last name and then first name in the format:
○ Besculides, Elias
○ Stewart, Ryan
● Player value: Player Struct

Stat Map → Map:


● String key: League name in the format:
○ “U6”, “U14”, also includes a “Total” key which represents all the players
● Player value: Stat Struct

Season → Class:
● Public:
○ Function void print_players(const string & FileName): Given a file name, it writes
the list of players to a file by league.
○ Function void update_stats(): When called, clears the original Stat Map and
begins to add a new statistic for each individual player in the Player Map
○ Function void add_player(const string & name, const int birth_year, const bool &
status): Self explanatory
○ Function void edit_player(string new_name, int new_year, bool new_paid): Self
explanatory
○ Function void delete_player(): Self explanatory
○ Function bool empty(): Returns the empty status of the player map
○ Function void new_season(const int new_year): Self explanatory
○ Function string display_name(): Self explanatory
○ Function string display_year(): Self explanatory
○ Function string display_league(): Self explanatory
○ Function string display_status(): Self explanatory
○ Function StatMap::iterator get_end_stat(): Self explanatory
○ Function StatMap::iterator get_stats(): Self explanatory
○ Function PlayerMap::iterator get_current_player(): Self explanatory
○ Function size_t get_current_pos(): Gets the current player position in the list
○ Function size_t get_player_count(): Self explanatory
○ Function void next_player(): Self explanatory
○ Function void previous_player(): Self explanatory
○ Function bool open(): Opens the season.txt file and reads all of the players into a
season
○ Function bool save(): Saves the current states of the season to the season.txt file
○ Function void search(const string & first, const string & last, const int year, const
bool search_paid, const bool paid): Searches for all players that match the
given inputs
○ Function int year(): Returns the season year
● Private:
○ Function string get_key_(const string & name): Given a name as a string, it
parses it into the format that fits the key
○ Function string get_first_(const string & name): Gets the first name in a full name
string
○ Function string get_last_(const string & name): Gets the last name in a full name
string
○ Function int get_league_(const int birth_year): Gets the league given the birth
year
○ Function void add_stat(string, bool status): Given the league and paid status
adds a statistic to the Stat Map
○ int current_year_: Self explanatory
○ string file_: The name of the file used to store the season in. The default
constructor sets this to season.txt
○ StatMap stats_: Self explanatory
○ PlayerMap search_players_: A new player map used for search results
○ PlayerMap::iterator current_search_player_: Self explanatory
○ PlayerMap players_: Self explanatory
○ PlayerMap::iterator current_player_: Self explanatory
○ size_t current_player_pos_: Self explanatory

You might also like