0% found this document useful (0 votes)
64 views40 pages

Tournament Planner and Updater Tool

IT grade 11 phase 1

Uploaded by

bc.choma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views40 pages

Tournament Planner and Updater Tool

IT grade 11 phase 1

Uploaded by

bc.choma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

The Creation and Implementation

Of A Tournament Style Planner


And Updater
Contents
......................................................................................................................... 2
Topic: ........................................................................................................................................... 2
Purpose of Program: ................................................................................................................... 2
Possible Solution ......................................................................................................................... 3
Scope ........................................................................................................................................... 3
................................................................................................................................ 4
User Story and Acceptance Test ..................................................................................................... 5
Functions performed by the program:........................................................................................ 8
Database Design ............................................................................................................................. 9
Table Design ................................................................................................................................ 9
Relationship Description ........................................................................................................... 11
Role of Database ....................................................................................................................... 11
Navigation ..................................................................................................................................... 13
Data dictionary .............................................................................................................................. 15
Variables and components........................................................................................................ 15
Textfile ....................................................................................................................................... 15
Arrays ........................................................................................................................................ 16
Gui Design ..................................................................................................................................... 18
Input, Processing, Output ............................................................................................................... 0
Input ............................................................................................................................................ 0
Process ........................................................................................................................................ 1
Output ......................................................................................................................................... 7
Validation .................................................................................................................................... 0
Bibliography .................................................................................................................................... 9
Scenario and Scope
Topic:
The creation and Implementation of an interactive tournament style planner and updater
Purpose of Program:
The increasing participation in sport has induced a positive influence on many aspects of
people’s lives. It supports positive mental health and develops healthy habits that provide
physical benefits such as developing coordination, physical fitness and strength. Yet with its
significant betterment, the increasing participation brings out a greater complexity in the
planning of sporting events. With sporting events comes numerous types of tournament styles,
all with the aim – to improve the quality of the experience for both viewers and competitors. A
good tournament style creates a more exciting and competitive finals. Each tournament style
has positives and negatives:
Robin Round
In this tournament style, each contestant meets every other participant. The primary
advantages of a Robin Round tournament are the increased number of games for consistent
participation and it is easier to understand and can produce a clear winner. The disadvantage is
that this type of competition is too long and may also require tiebreaking procedures.
Single Elimination Tournament/ Knockout/ Sudden death
This a type of elimination tournament where a loser of each match is immediately eliminated
from the tournament. Single elimination decides a winner quickly, and gives every competitor
the same path to victory. However, it is not always the best solution, in part because it can
interject an unfair amount of randomness into the process.
Double Elimination Tournament
A double-elimination tournament is a type of elimination tournament competition in which a
participant ceases to be eligible to win the tournament's championship upon having
lost two games or matches.
The double elimination system reduces the role played by luck, so is more of a faithful refection
of player ability, making it a very fair tournament system. Participants have another chance of
competing increasing the chance of getting a more eligible winner of the tournament.
Therefore, my program needs to be able to implement a tournament style that will create a
more exciting and competitive tournament. It must be able to plan the tournament in a fast
and efficient way. My program needs to be to adapt to changes, update information if changes
in data are made
Possible Solution

The possible solution to create an efficient and reliable tournament style and planner. It will
implement a Robin-round tournament style seeing that it is the most fair and reliable format
that efficiently makes use of competitors’ sporting abilities during the tournament. Instead of
having a lot of paper work, you can make use of this program. It will be able to add participants
into the tournament. Add games as well as delete games. This program will also be able to
update information if changes are made without affecting other data. Using validation
techniques, it will ensure that adequate required information is provided. It will ensure that
eligible participants are allowed to enter the competitions. To protect data, a security system
will be implemented in this program. This will make sure that admin users and normal users
have access to the correct information. Thus, the user will have to login with the correct
credentials to access information. Then the program will help users to navigate and report to
their needs.

Scope
This program will be able to implement a tournament style for the user and determine the
winner at the end of the tournament. What it will not be able to do is: to implement other
tournament styles besides the Robin round. It will not be able to automatically schedule games;
the admin user is the one that coordinates the addition of games.
Task Definition
Sports organisers are in-need of a tournament style planner and updater to help them to
efficiently coordinate sporting events. Organisers need a program that is able to input data and
update existing data that pertain to the tournament. After a critical analysis of tournament
management – it was discovered that organisers struggle with adding more participants and
creating valid games for the tournament. Without an efficient program, organisers find
themselves with unorganised manually collected data that is either paper-based or stored on a
random database. Manual data collection brings about human error and it is time consuming.
The problems of not having a tournament style planner is that: it is harder to update data,
update scores, add or delete participants or games. Without a proper tournament planner that
is able to update data – the organiser ends up with inaccurate and inconsistent data. Secondly,
participants do not have access to game dates unless told by the organiser. If the organiser
does not tell a participant about a tournament – he/she will not be able compete. The solution
to thus problem is to help organisers efficiently plan sporting events in-order to provide a
memorable and successful sports experience. This tournament style planner and updater will
be able to: provide accurate and up to date information to participants, improve
communication keeping all parties informed through a convenient access for all users. It will
allow organisers to retain full control, to change schedules, update scores and even cancel
games. It should capture all the accurate participant data and allows access to this data by the
correct members. Using validation techniques, it will ensure that adequate required
information is provided. It will ensure that eligible participants are allowed to enter the
competitions. To protect data, a security system will be implemented in this program. This will
make sure that admin users and normal users have access to the correct information. The
target audience is not only the sports organisers but participants and coaches too. This program
will be able to execute a tournament style planner for a tennis
tournament and decide the champion at the conclusion of the competition. What it'll not be
able to do is: to execute other competition styles other than the Robin Round. It'll not be able
to consequently plan games; the admin user is the one that facilitates the addition of tennis
games and keep up with scoring.
User Story and Acceptance Test
Possible Task Normal Requirement Administrators
Requirement
Require username No specific requirement No specific requirement
Require password  At least eight  At least eight
characters in length characters in
 2 integers minimum length
 At least one special  2 integers
character that is minimum
neither a letter of the  At least one
alphabet or a number. special character
that is neither a
letter of the
alphabet or a
number.
Username: complex or simple Simple Simple
Password: complex or simple Complex Complex
Add Learner

Limitations, roles and activities:


NORMAL USER (Sport Participants)

ROLE  The normal users are one of the


clients to use the program
 Their role is to access sufficient
information that is necessary to the
users – this includes adding
participants to games and viewing
results.
ACTIVITIES The users will be able to do:
1. Enter their password and username
(login or signup)
2. Add themselves to the list of players
to participate in games
3. View tournament days so that they
know when they are participating
4. View scores
VALUES To join a tournament, this user (coach of a
team) has to add his players to the
tournament. This program enables him to
access the dates for tournaments and
games. The program will specify the players
involved in the game too.

ADMINISTRATIVE USER

ROLE The administrative users manage the all


information that has been inputted by
normal users including the players data.
They coordinate the tournament and are
the main users of this tournament style
planner and updater.
ACTIVITIES These users are able to perform this:
1. Enter the password and username
2. View all the inputted information of
normal users on the admin page
3. Add participants to games
4. Determine the winners to the
games
5. Edit players’ information.
6. Manage venues for games
7. View results
VALUES In-order to coordinate the tournament
effectively, the admin user needs this
program to plan the sporting event. He will
use it to add players to tournaments, edit
their information and add them to games.

Normal User (Sport Participant) Administrative User (Tennis


Organiser)
Requirements/Goals For tennis players, the program For tennis organisers, the program
must be able to: must be able to:
1. Add themselves to the 1. Add tennis participants to
participants list the games
2. View game dates 2. View the reports of the
3. View the games will be games
taking place 3. Edit games
4. View the results of the 4. Edit the information of
games users
5. Delete players and games
Limitations The normal users cannot perform These users cannot do the
certain tasks: following tasks:
1. Skip compulsory security 1. Alter the programmed
authentications security systems
2. Access information 2. Take part in games
regarding the user inputs 3. Change the type of
and they cannot eliminate tournament style that the
certain authentications. program implements
3. Delete other participants 4. Delete players that have
4. Edit other players’ details. played games
5. Determine the
winner/results of the day
6. View other users’
passwords and
usernames
7. Access the admin’s page
They cannot add or remove data
on administrators’ forms.
Interaction with Seen on case diagram Seen on case diagram
System
Functions performed by the program:
1. Sign up – this function allows the use to formally register on the app. Here the user
officially joins the system. The sign=up function enables a user to create a new account
as a new user so that the user can login in later with his/her credentials. In terms of the
tournament style planner – the program requires the user to enter the following
credentials: Name, surname, username and password. The system will process the
inputted data and save it.
2. Login – this function enables the user to enter into their account as a returning user.
Unless changed, it requires the same credentials that were used to set up the account –
specifically a username and a password. If wrong credentials area inputted, the user will
be notified through a user-friendly message.
3. Add Player – this function enables both types of users (coach and coordinator) to add
participants to the system. To be more precise – after adding a participant – he/she is
added to a database that contains all players. Players that are not involved in games are
shown to the tournament coordinator so that he/she can add them to games.
4. Edit Player – this function is only available to the admin user - the tournament
coordinator, he/she can edit the players’ information.
5. Delete Player

Database Design
Table Design
Table Name: Player

Field Name Data Type Field Size


PK PlayerID Autonumber Long Integer
PlayerName Text 25
School Text 50
Team Text 25
Age Number

Table Name: Player

Field Name Data Type/Format Field Size/Format


PK GameID Autonumber Long integer
GameDate Short Date 25
Venue Text 50
Draw Yes/No 25
Age Number Long Integer
Player1ID Number Long Integer
Player2ID Number Long Integer
WinnerID Number Long Integer
Table Name: Accounts

Field Name Data Type/Format Field Size/Format


PK UserID Autonumber Long integer
Email Text 100
Password Text 50

Relationship Description

Relationship type: one-to-many relationship.


Each player can play multiple games. Thus,PlayerID is linked to PlayerID1, allowing a
relationship between the two tables

Role of Database
The main purpose of this database is to store data for the users – specifically, to store the
information about the tournament. The database consists of two tables that store important
data – one being the Player Table: The ‘Player’ table stores the participants’ data. When a
tennis participant joins the league through the tournament style planner – he/she is
automatically added to the Player table. The normal user and the admin user both can add
players but only the admin user (tournament organiser/coordinator) can edit players’
information. When there is a concern about pre-recorded data – it is recorded to the admin.
Then the admin -using the tournament style planner- can make modifications. When a player is
added to the official participants (Players’ table), he or she is automatically assigned to a unique
ID.
Secondly, the database consists of a ‘Game’ table which will only be manipulated by the admin
user to create, add or delete games. The data in this table can be accessed by all types of users
but can be modified by the admin user (sport organiser/coordinator). It will appear as a ‘Read-
Only’ to the normal users (General school coaches and participants).
Navigation
Navigation from the start, through home, to the login page.

Navigation from the login page after entering correct admin login credentials.
Navigation from the login page to the normal user page after correct user credentials.
Data dictionary

Variables and components


Local Variables Data Type Component
sUserName String edtUsername: TEdit

sPassword string edtPassword: TMaskedEdit

sPLayerName String edtPlayerName: TEdit


sSchool String edtSchool: TEdit
iAge Integer sedAge: SpinEdit
sTeam String rgpTeams: TRadioGroup
sChooseName String cmbChooseName:
TComboBox
sNewName String edtNewName: TEdit
sNewSchool String edtNewSchool: TEdit
sNewTeam String cmbNewTeam: TCombobox
iNewAge Integer sedNewAge: TSpinEdit
sDeleteNames String cmbDelNames: TComboBox
sDelName String edtDelNames: TEdit
tday TDate calDate: TMonthCalendar
bDraw Boolean Cbxdraw: TCheckBox
GLOBAL variables Data Type Component
icount Integer N/A
iSchools Integer sedSchool: TSpinEdit
arrNames array [1..1000] of string N/A
arrSchools array [1..1000] of string N/A
arrDiffSchools array [1..1000] of string N/A

Textfile

Textfile: Deletedgames.txt
This textfile is used to store games that are deleted from the database. If the tournament
coordinator accidently deleted a record, they are able to retrieve it from the textfile. This
textfile will act as “recycle bin” that we store all deleted records of game information
Screenshot of textfile:

Arrays

Purpose:
How are the arrays going to be used?
Two parallel arrays and an additional array are going to be used as follows:
The first parallel arrays of this program are going to be used to store all schools involved in the
tournament. They are utilised in the program to avoid participants from the same school having
a match together. When the program is executed it goes through all schools in a database,
perform some function to get rid of duplicates and store the unique schools in an array. In
terms of arrays, the first array stores all schools in a database, then functions are performed
using the first array to get rid of duplicate schools in the first array. Once the duplicates are
eliminated, the remaining unduplicated schools are stored into the second array. This array will
be assigned to a combobox whereby all schools in the array become items of the combobox.
When a specific school is selected, the learners that belong to that school will be visible to the
admin user. These learners are extracted from the third array which is parallel to the first
because when schools were added to the first array, learner names were also added
simultaneously to the third array.Thus, this will ensure that, when the admin user is adding
games – he/she will not create a match between 2 players of the same school.

1 2 3 4 … 1000

Elspark StJohns Peters Columbia CarlTech

Populate Array
First array: this array is populated using a while loop, it adds all schools that are in the database.
Second Array: this array is filled using a while loop that is terminated when the end of database
is reached, it will continuously add player names to the array until the end of table.
Third array: this array is populated after the schools is the first array are processed and
duplicated are eliminated.
Declaration
arrNames: array [1 .. 1000] of string;
arrSchools: array [1 .. 1000] of string;
arrDiffSchools: array [1 .. 1000] of string;
Gui Design
GUI1: Welcome Page

TOE Chart
T – task
O – object
E – Event

Task Object Event


Go to sign up page btnSign Click
Go to login page btnLogin Click
Display help and give btnHelp1 Click
assistance to user when
required.
Terminate Application btnAbort1 Click
GUI2: Sign-Up Page

Task Object Event


INPUT
Get user Email edtEmail None
Get user Username edtUsername None
Get user Password edtPassword None
Process
Go to sign up page btnSignups Click
Go to login page btnLogins Click
Display help and give btnHelp2 Click
assistance to user when
required.
Close current page and go to btnClose1 Click
previous page
Terminate Application btnAbort2 Click
Output
Show or hide password imgPassword MouseDown
MouseUp
GUI3: Login Page

Task Object Event


INPUT
Get user Username edtUser None
Get user Password edtPass None
Process
Go to sign up page btnSign1 Click
Go to login page btnLogin1 Click
Display help and give btnHelp3 Click
assistance to user when
required.
Close current page and go to btnClose2 Click
previous page
Terminate Application btnAbort3 Click
Output
Show or hide password imgPass MouseDown
MouseUp
GUI4: Home Page

Task Object Event


Go to Add Player page btnGoAddPlayer Click
Go to Edit Player page btnGoEditPlayer Click
Go to Delete Player Page btnGoDeleteplayer Click
Go to Add Game Page btnGoAddGame Click
Go to Edit Game Page btnGoEditGame Click
Go to Delete Game Page btnGoDeleteGame Click
Go to View Reports Page btnViewReport Click
GUI5: Add Player Page

TOE Chart

Task Object Event


INPUT
Get Player Name edtName None
Get Player School edtSchool None
Get Player Age sedAge None
Get Player’s Team rgpTeam Click
Process
Add Information into btnAddPlayer Click
database after validation
Sort Names on the dbGrid btnSort1 Click
Display help and give btnHelp4 Click
assistance to user when
required.
Close current page and go to btnClose3 Click
previous page
Terminate Application btnAbort4 Click
Output
Display Information is btnSort, dbGrid1 Click
alphabetical order, according
to Player Name
GUI6: Edit Player

TOE CHART

Task Object Event


INPUT
Get the player whom the cmbName None
user wants to edit
Get the database field that rgpedit Click
the user wants to edit
Get Player’s new Name edtnewName None
Get Player’s new School edtnewSchool None
Get Player’s new Age sednewAge None
Get Player’s new Team rgpnewTeam None
Process
Edit the information after btnUpdate Click
validation
Sort Names on the dbGrid BtnSort2 Click
Display help and give BtnHelp5 Click
assistance to user when
required.
Close current page and go to BtnClose4 Click
previous page
Terminate Application BtnAbort5 Click
Output
Display Information is BtnSort2, dbGrid1 Click
alphabetical order, according
to Player Name

GUI7: Delete Player

TOE CHART

Task Object Event


INPUT
Get the player whom the cmbDeleteNames None
user wants to delete
Process
Delete the player after btnDelete Click
validation
Sort Names on the dbGrid BtnSort3 Click
Display help and give BtnHelp6 Click
assistance to user when
required.
Close current page and go to BtnClose5 Click
previous page
Terminate Application BtnAbort6 Click
Output
Display Information is BtnSort2, dbGrid1 Click
alphabetical order, according
to Player Name

GUI8: Add Game

TOE Chart

Task Object Event


INPUT
Get the date of Game dtpGameDate None
Get the Venue of the game edtVenue
Get Player School cmbSchools Click
Get Player Name cmbNames Click
Get the game result rgpResult Click
Process
Add Information into btnAddPlayer Click
database after validation
Sort Names on the dbGrid btnSort4 Click
Display help and give btnHelp7 Click
assistance to user when
required.
Close current page and go to btnClose6 Click
previous page
Terminate Application btnAbort7 Click
Output
Display the first Player cmbPlayers, pnlPlayer1 Click
Display the second Player cmbPlayers, pnlPlayer2 Click
Display Information is btnSort, dbGrid1 Click
alphabetical order, according
to Game Date

GUI9: Edit Game Page

TOE Chart

Task Object Event


INPUT
Get the game to be updated Dbgrid5 Click
Get the database field that is rgpEdit
going to be edited
Get the date of Game dtpDate None
Get the Venue of the game edtnewVenue None
Get Player School cmbnewSchools Click
Get Player Name cmbPlayer Click
Get the game result rgpResult Click
Process
Add Information into btnAddPlayer Click
database after validation
Sort Names on the dbGrid btnSort4 Click
Display help and give btnHelp8 Click
assistance to user when
required.
Close current page and go to btnClose7 Click
previous page
Terminate Application btnAbort8 Click
Output
Display the game to be dbGrid5, redGame Click
edited
Display Information is btnSort, dbGrid1 Click
alphabetical order, according
to Game Date

GUI9: Delete Game


TOE Chart

Task Object Event


INPUT
Get the game to be deleted Dbgrid6 Click
Get the date of Game dtpDate None
Get the Venue of the game edtnewVenue None
Get Player School cmbnewSchools Click
Get Player Name cmbPlayer Click
Get the game result rgpResult Click
Process
Add Information into btnAddPlayer Click
database after validation
Sort Names on the dbGrid btnSort5 Click
Display help and give btnHelp9 Click
assistance to user when
required.
Close current page and go to btnClose8 Click
previous page
Terminate Application btnAbort9 Click
Output
Display the game to be dbGrid5, reddelGame Click
edited
Display Information is btnSort5, dbGrid1 Click
alphabetical order, according
to Game Date

GUI10: View Reports Page

Task Object Event


Get all the games played and btnWinners Click
won
Display the winner among btnwinner Click
the schools
Display all games that were dbGrid6 Click
played and won
Display the school that won Btnwinner, redReports Click
Input, Processing, Output
Input
Input Data Format of input GUI Component Source of
Type input
Username String. Letters and Numbers, edtUsername: tEdit. Keyboard.
Password String Letters, numbers and other edtPassword : TMaskedEdit Keyboard.
characters. string of no
smaller than 8 characters
sPlayerName String Text edtName: TEdit Keyboard
sNames String Select from list cmbNames : TComboBox
sSchool string GeneralText/Select from list cmbSchool: TComboBox Mouse
Keyboard
sTeam String Select from list rgpTeams: TRadioGroup Mouse
Keyboard
iAge Integer sedAge: TSpinEdit Keyboard
sSchool String Choose from list Array
sDiffSchool String Select from Combobox Array
tday Date Select from Calender calDate: TMonthCalender Keyboard,
Mouse
iID Integer Inputbox – user is prompted Keyboard
by a message to input a value
bDraw Boolean cbxDraw : TCheckbox Mouse

Validation
Input Validation

Input Validation
Data Type Component Validation type. Message Message
when Data when Data
Validated does not
validate
UserName edtUsername: TEdit Check that the person entered “Correct “Enter your
data credentials” username”
Password edtPassword:  Check if the user has Show Show
TMaskedEdit entered data message message
 Performs a check digit Actual Actual
to check if the length is Message Message
at least 8 characters,
 Check if there is an “Correct “Enter your
integer value, a special credentials” password”
character and enough
letter.
sPlayerName edtPlayerName:  Performs a datatype Showmessage Showmessage
TEdit check Actual Actual
 Contains no numbers, message: message:
spaces or special
characters “Enter a
Name that
only contains
letters”
iAge sedAge: TSpinEdit  A range check is Showmessage
performed on the age Actual
entered. Message:
 A participant in a junior “Enter
team must fall appropriate
between the following age”
age range: 12 – 14
 A senior participant’s
age must fall under the
following age range:
15-18.

Process
Data processing

1 Logging in with correct credentials


2 Reading from database to see if correct password and username has been entered
3 Adding players to the database
4 Deleting Players and Matches
5 Editing Player and Matches Information
6 Extracting data from database and storing it into arrays
7 Utilising a textfile to store all games deleted
8 Deleting duplicated
9 Sorting data
10 Determining the winner of the game

WHAT processing needs to be done HOW processing will be done


Check username and password match 1. Extract the password and username from the
with data in database input components
2. Firstly, check is the credentials do not belong
to the admin user, if they do: an admin page is
accessed
3. If not, we check for the username in the
database.
4. Once it is found, the program checks if the
password entered matches the password
corresponding with username in the database
5. If both credentials are correct, an appropriate
form is displayed.

ALGORITHM:

1. Function: Login using database


2. Using the database do

3. Check if username is correct and admin


username = correct admin then
4. Begin
5. Show tournament form
6. End
7. Else
8. Begin
9. Find the username in the database;
10. Find the password in the database
11. Begin
12. If username is found and password is found
show the normal user form.
13. If not, display a message: ‘credentials are
incorrect;
14. End;

Adding Players to the database


1. Firstly, you assign the variables to the
components or source of inputs
2. Ensure that all necessary data is provided by
user before adding to database
3. Add information to database
,,,

1. Player Name  edit box text


2. School  edit box text
3. Age spin edit
4. sTeam  Radio group
5. begin
6. Check if user selected a team on radiogroup,
7. Check is user entered the player name
8. Check if user entered player school
9. Check for appropriate age
10. BEGIN
11. Insert into table
12. PlayerName field  Name
13. School field  School
14. Age Field  Age
15. Team Field Team
16. Post that information into table
17. END

Editing a Player’s Information


1. Firstly, the admin enters the ID of the specific
Player whom he/she wants to modify.
2. A radiogroup is provided whereby the user will
select the specific information about the player
he/she would like to edit. For e.g Name, School,
Age
3. Afterthat, the user will input the data he wants to
replace the existing data in the database.
4. The components are refreshed and sorted

ALGORITHM

1. Using the database do


2. BEGIN
3. Input
4. Prompt for Player ID
5. Find player with the player ID entered after
prompt.
6. Allow database to be edited
7. Change the information stated by the user
8. Post the new information into database
9. END

with dmTennis do
begin
iid := inputbox(‘ID’,’Enter ID’,inttostr(’’))

case rgpEdit.itemindex of

0:
begin
sNewName := edtNewNAME.text;
bfound := false;
tblPlayer.first;
while (not tblPlayer.eof) and (bfound <> true) do
begin
if tblPlayer['PlayerID'] = iID then
begin
bfound := true;
tblPlayer.edit;
tblPlayer['Name'] := snewName;
tblPlayer.post;
end;
tblPlayer.next;
end;

end;
1:
begin
sSchool := edtSchoolName.text;
bfound := false;
tblPlayer.first;
while (not tblPlayer.eof) and (bfound <> true) do
begin
if tblPlayer['PlayerID'] = iID then
begin
bfound := true;
tblPlayer.edit;
tblPlayer['School'] := sSchool;
tblPlayer.post;
end;
tblPlayer.next;
end;
end;
2:
begin

if rgpChooseTeam.itemindex = -1 then
begin
showmessage('Please select a new Team');
exit
end;
sNewTeam :=
rgpChooseTeam.items[rgpChooseTeam.itemindex];
bfound := false;
tblPlayer.first;
while (not tblPlayer.eof) and (bfound <> true) do
begin
if tblPlayer['PlayerID'] = iID then
begin
bfound := true;
tblPlayer.edit;
tblPlayer['Team'] := sNewTeam;
tblPlayer.post;
end;
tblPlayer.next;
end;
end;
3:
begin
iNewAge := sedNewAge.value;
bfound := false;
tblPlayer.first;
while (not tblPlayer.eof) and (bfound <> true) do
begin
if tblPlayer['PlayerID'] = iID then
begin
bfound := true;
tblPlayer.edit;
tblPlayer['Age'] := iNewAge;
tblPlayer.post;
end;
tblPlayer.next;
end;
end;
end;
end;
end;
Deleting a player from a Database 1. The admin user will enter a PlayerID that will
uniquely identify the player that is supoosed
be deleted
2. The program searches for a record with that
specific ID.
3. Once the record is found that has a player with
that specific ID, the program checks whether the
player was involved in a game or not from the
Games table
4. If the player was involved in a game, to avoid
errors- the program will inform the user that
record cannot be deleted.
5. If the player was not involved in a game, then the
record can be deleted and a message pops
informing the successful procedure.

ALGORITHM

1. Input
2. Name  combobox
3. Bfound  false
4. Locate a player with the same Name
5. Once found bfound true and we ID  player’S
ID
6. Check for a learner with that specific ID in the
games table
7. If found, player is not deleted
8. If not found, Player is deleted

with dmTennis do
begin
// we want to make sure we delete a player that has not
played a game

sName := cmbDeleteNames.text;
bfound := false;
tblPlayer.first;
while (not tblPlayer.eof) and (bfound <> true) do
begin
if tblPlayer['PlayerName'] = sName then
begin
bfound := true;
iID := tblPlayer['playerid']
end;
tblPlayer.next;
end; // end of while loop

bfound := false;
tblGames.first;
while (not tblGames.eof) and (bfound <> true) do
begin

if (tblGames['PLAYERID1'] = iID) or
(tblGames['PLAYERID2'] = iID) then
begin
bfound := true;
end;
tblGames.next;

end;

if bfound = true then


begin
showmessage('Cannot delete a player that participated
in a Game');
exit
end;

sName := cmbDeleteNames.text;
bfound := false;
tblPlayer.first;
while (not tblPlayer.eof) and (bfound <> true) do
begin
if tblPlayer['PlayerName'] = sName then
begin
bfound := true;
tblPlayer.delete;
end;
tblPlayer.next;
end; // end of while loop
// we want to refresh the data inside the combobox
cmbDeleteNames.clear;
tblPlayer.first;
while not tblPlayer.eof do
begin
cmbDeleteNames.items.add(tblPlayer['PlayerName']);
tblPlayer.next;
end; // end of while loop }
cmbDeleteNames.sorted := true;
// end of using data module

end;

Utilising a textfile to store all games ALGORITHM


deleted 1. Test if file exists.
2. If the file does not exist, create a new textfile.
3. Assign text file to a text file data type variable.
4. Open the file for writing
5. Add the deleted games into the textfile
6. Closefile

Output
Data Format Component
Name, Surname, details and Name: <name field in text> memDetails : TMemo
count Surname: <surname field>
Details: tab<count variable>
Data contained in the ‘Player’ ---------- TDBGrid
database table
Data contained in the ‘Player’ ---------- TDBGrid
database table
Game Details Text memGames
Data contained in the ‘Player’ N/A TDBGrid
database table
Data contained in the ‘Game’ N/A TDBGrid
database table
Data contained in the ‘Game’ N/A TDBGrid
database table
Data contained in the ‘Game’ N/A TDBGrid
database table
Name of the first player in a Text TPanel: pnlPlayer1
match
Name of the second player in Text TPanel: pnlPlayer2
opposition to the first player
Display the game to be edited Text TRichEdit: redGame
Display the game to be deleted Text TRichEdit: reddelGame
Bibliography
L.Roundy.Study.com.Physical, Social and Emotional Benefits of Participating in
Sports.11/15/2021. https://study.com/academy/lesson/physical-social-and-
emotional-benefits-of-participating-in-
sports.html#:~:text=Participating%20in%20sports%20has%20a,%2C%20physical%
20fitness%2C%20and%20strength.
C.Berman.SportsRec.Advantages & Disadvantages of Single
Elimination.09/04/2011. https://www.sportsrec.com/advantages-disadvantages-
single-elimination-12031976.html

You might also like