Вы находитесь на странице: 1из 55

Jevoun Tyrell Teacher: Ms.

Nugent

Table of Contents

Contents Pages

Acknowledgements 2
Description of Organization 3
Data Collection Methodology 4
Problem Statement 56
Program Description 79
Context Level Diagram 10
Level 1 Data Flow Diagram 11
Entity Relationship Diagram 12
System Requirements 13
Functional requirements
Non-Functional requirements
System Architecture 14 16
General Description
System Structure
Physical Architecture System Hardware
Justification of Technical Choices
System Requirements and Architecture Linkage
Data Structure Design 17 19
Data Dictionary
HIPO Diagram
Algorithmic Design 20 23
Source Code 24 49
Output Screens 50 54
Test Plan 55
Appendix 56
Interview questions

1 | Page
Jevoun Tyrell Teacher: Ms. Nugent

Acknowledgements
I thank GOD for his unfailing help, support, strength and guidance in doing this Computer

Science SBA. Without him it would have not been done and I would not have been able to thank my

mother, despite lack of wide experience in computer she has proven to be a tremendous contributor to the

development of this stellar system, teachers such as Ms. Nugent a great teacher that has been provided by

GOD to help in the development of this system and Mr. Nixon that has given some guidance along the

way that has contributed much to this system. Also with the help of classmates such as Nickolas

Matthews, Tai-Vaughn White, Bradford Coore, Kino Porteous, Kevaughn Campbell, Kevaughn Facey,

Skillarchie Davis, Kimani Munn, Shaquile Crosse and friends like Tanya-lee Lawrence and many others

have helped from day one. I thank all for your help and support.

2 | Page
Jevoun Tyrell Teacher: Ms. Nugent

Description of Organization
The Calabar High School Basketball Team first entered the Inter-School Basketball

Competition for the modern furnishing trophy in 1972. From then till now, the school has risen to

the top of the table, in the under 16 and 19 age groups and topped the island for both. They have

a stellar team of management and coaches that look to improve each fundamental ability of their

boys. To do this each match and during training, statistics are taken to measure the frequentness

of their efforts to help the team to victory and also the frequentness of mistakes made by each

player and as a group. These statistics are also required by ISSA to keep track of performance to

later reward or penalize players.

Each official match, a broad sheet is given to a representative of each team fixed to play,

with a list of specific statistical data to be collected on each player during play and produce the

results on the sheet to the officiating referee from ISSA. Now when this sheet is given up, the

team may never see it again, unless a picture of it is taken. With this picture, the teams coaches

use the data to enhance the players weaknesses and work to strengthen the team for the next

match.

3 | Page
Jevoun Tyrell Teacher: Ms. Nugent

Problem Statement
Now, the team does not receive the statistical broadsheets after being written up as they

go to the Inter- Secondary Sports Association (ISSA). Due to this, the coaches find it challenging

to work with photos when working with the team. This is time consuming and frustrating as the

coach will have to manually go through photos to view statistics. They have now requested a

program that would work alongside the traditional manual statistical recording at the official

table. The program is to calculate each statistical data record for each player and show a broad

sheet of whatever is entered, at any time of asking. The program should also be able to write to a

text file the tabular data collected much like the broadsheet which the team will have a hard copy

of the statistical data for any match.

4 | Page
Jevoun Tyrell Teacher: Ms. Nugent

Data Collection Methodology


Research

The data collected on how to proceed in developing this software was partly pooled by

conducting web-based and text-based research on statistical data that would be necessary to be

collected during a match to be later used to help in the development and tuning of player skill.

Interviews

Interviews with the coaches were conducted to clarify what they would need to see in the

broadsheet created by the program.

An interview was conducted with Head coach of the Calabar High School Basketball

team, Ludlow Barker, which was scheduled and performed on August 16, 2016. This method was

utilised to ensure full input and detail outline by the potential end-user, hence the data was

collected in such a manner that allowed for open ended responses to questions to be given. This

proved effective by permitting the interviewee some amount of freedom to give intensive detail

on the subject. It also assured the elimination of any sort misconceptions in understanding the

issue that the coach and his assistant would have faced and the manner in which it is to be

addressed from a legitimate and functional perspective, to bring about the sought-after end-goal.

In employing the interview method, the prospect of delving into every aspect and the level of

detail needed by the coaches, as well as the ability to tailor the questions in no static format but

with a general idea in mind unveiled the problem faced by the coaches and allowed us to design

and create the appropriate software to calculate the scores and statistical points of value to the

team (such as number of blocks, steals, rebounds etc.) of each player and the total points by the

team.

5 | Page
Jevoun Tyrell Teacher: Ms. Nugent

Observation

In addition to conducting the interviews, a few matches were observed, where the use of

the regular paper based system of collecting stats to record player performance and recording of

the data itself was lacking in efficiency, as pages were always given back to officials of ISSA and

pictures of the data collected on the sheets can be taken by the coaches to attempt to cross

reference player performance data. The coaches have made it known that they would like their

own system which would effectively support progress and help the coaches guide their champion

team to successive victories.

6 | Page
Jevoun Tyrell Teacher: Ms. Nugent

Program Description
Once the program initially loads it presents the user with a confirmation screen that is

used to ensure the user would like to continue before even opening the program, if the user enters

the letters Y or y the welcome animation screen will be displayed and the user will proceed

automatically to the top level menu. If the user however enters N or n the user will greeted

and the program will close.

Upon getting to the top level menu (the menu function), the user is presented with

options, to either 1, start entering player data, 2, to display a broadsheet of the any entered

data in the current run time or to, 0 exit the program.

Provided the user chooses option 1 to start entering player data, the user will begin to

enter basic game information (in the Teaminfo function), this will be used to title each

broadsheet produced, basic information such as the opposing team name, the amount of players

on the Calabar team at the game being recorded, it will then check if the amount entered is above

the league limit of twelve players. After continuing out of the Teaminfo function into the

statcol function, the user is promoted to enter the jersey number of the player that data will be

entered about in that single instance. After this, the user is presented with thirteen options to

choose from to enter player data, with entering 0 resulting to an exit to the top menu (the

menu function) if the user chooses an option 1 12 the program goes to the collector

function.

The first option in the collector function with the corresponding key entry being the

number 1, allows the user to add field goal (the regular two point given to a shot during main

play) points to the players score slot and to the teams main point score. Option 2 allows the

7 | Page
Jevoun Tyrell Teacher: Ms. Nugent

user to add the amount of attempts at field goals in each play instance (the play instance is a 30

second time period in which the team with the ball has to make a shot and is reset each time the

ball hits the rim, backboard or goes out of bounds). Option 3 will allow the user to add free

throw point (the regular one point given to a successful free throw shot during main play) to the

players score slot and to the teams total point score. Option 4 will track free-throw attempts

according to afore entered player jersey number. Option 5 permits the user to enter the amount

of successful three point shot made by the corresponding player in the regulation shot time while

option 6 lets the user track the amount of attempts overall by each player.

Option 7 lets the user tally the amount of rebounds made by each player indexed by the

players jersey number. If option 8 is chosen, the user will use this sub-function to tally assists

made by the players. In the event the user chooses option 9 this will allow the user to tally the

blocks made by the player chosen by his jersey number. Option 10 will add tally data for the

steals made by each player indexed by his jersey number. Option 11 is for tallying the fouls

made by players and finally option 12 is to add data on turnovers (a turnover is the resulting

penalty of handing over the ball to the next team as directed by the referee) made by each player.

Option 0 is to exit to the main menu of the menu function. Every option is preceded by the

prompt to enter the jersey number of the player that data is to be entered on, before choosing one

of the thirteen options.

After all the options are carried out at the end of request the score of the tea, is displayed

in a message. At the end of each situation in the statcol menu, the user is brought to the jersey

number prompt screen where if one would rather go to the top main menu, menu function, the

user enters 0.

8 | Page
Jevoun Tyrell Teacher: Ms. Nugent

In the main menu, the menu function, option 2 allows the user the print to a text file

and display on screen the complete simulated broadsheet of all the statistical data on each player

indexed by their jersey number and data on the team itself. At the end of each of the completed

menu situations (in the section of the broadsheet population) the user is brought back to the top

level menu, the menu function to choose what further actions they would want or to exit the

program.

9 | Page
Jevoun Tyrell Teacher: Ms. Nugent

Context Level Diagram

10 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

Level 1 Data Flow Diagram

11 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

Entity Relationship Diagram

12 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

System Requirements
Functional requirements
Must be able to calculate scores for each player and the total score for the team without
error in real time.
Must be able to index each tabulated data entry under the entered player jersey numbers.
Must be able to independently tally the total score of the team on each of the three point
calculation sub-functions in real time.
Must be able to collect all relevant data on each players performance in real time.
Must be able to produce a broadsheet of the collected data at end of match.
Must be able to run on any Microsoft Windows device (windows 7 and up).

Non-Functional requirements
Can show the score of the team after every data entry.
Can display a welcome screen at the start of use.
Can ensure the user will want to continue use once the program has first booted.
All players must be logged at match start for stats collection
All players must have a unique jersey number
Regular officials from ISSA must be able to use the software.

13 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

System Architecture
General Description
The system is designed to address the issue of the coaches dissatisfaction and

inefficiency in their ability to track and develop their players along the lines of strengths and

weaknesses in previous games, done by the use of the tabulated data collected in each match and

collating this data in a more organized and easily accessible format.

System Structure
The system consist of a team score collector and or coach/es (the coaches dont mainly

enter the information because this is to be collected in game), and by regulations it is legal for

this to be a representative from the school, who records to the system, players and team data

including jersey numbers, successful field goals, free throws and three point shots, the total

attempts to score made by each individual player on the team, the number of rebounds, blocks,

steals, assists, fouls and turnovers made by each player where all is also indexed by each players

jersey number , the team score collector whom collects all this data and stores it to the texts files

to be given to the coaches whenever requested.

14 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

Physical Architecture System Hardware


System must be equipped with at least 1 GB of available storage space.

System must possess a Windows OS of Windows 7 (Service pack 2) or higher (Windows

8, 8.1 or Windows 10).

System must possess an available 1 GB of RAM.

System must possess processing power equivalent to or surpassing 1.66 GHz.

Justification of Technical Choices


Data stored as text occupies more storage space.

A moderately supply of storage is necessary to log the data at statistics of the numerous

matches played by each of the teams (under 14, 16 and 19).

It is necessary for the system to be able to withstand the continuous strenuous workload

that is constantly needed to be in operation at high speeds, as in keeping with the fact that

basketball is a fast paced sport, and do this continuously without stuttering.

The Operating System limitations were given to a minimal capacity of Windows 7 as any

Microsoft OS previous to this would lack the necessary features to run the program.

15 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

System Requirements and Architecture Linkage


For feasible computation as it regards to scoring and statistical recording, it is necessary

for the system to handle the myriad of complex calculations in real time. This means

incorporating player statistical data on each player along with indexing that data under each

players jersey, a collective team point standing and the respective calculations involved in

collating the data for the coaches to use. With the architecture proposed it is believed that the

system will perform its duties with remarkable speed and reliably.

16 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

Data Structure Design

Data Dictionary

Name Description Type Date


choice To store and Integer 30/03/2017

17 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

display the
correspondin
g menu of
choice in the
menu
function

homenum The gender Integer 30/03/2017


of the
registered
customer,
being Male
or Female

Home_Playernu To store and Integer 30/03/2017


m display the
players
jersey
number

option To store the Integer 30/03/2017


users choice
in broadsheet
function

stat To store integer 30/03/2017


users choice
for statcol
function
menu

Visitors To store and String 30/03/2017


display the
opposing
team name

would To store Character 30/03/2017


users choice
to initially
check if the
user would
like continue
use of the
program at
first boot.

18 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

Algorithmic Design

19 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

Narrative
Program loads to int main, contd function starts.

contd function starts

Prompt user to continue the use of the program in the contd function.

Read user input would.

If input would equals N or n program will go to end and notuse function and display
message Ok bye I hope we can work together some day!!! =-), Goodbye thanks for using the
Calabar High School Basketball Statistics Collector
Program ends and closes

If input would equals Y or y the program will move to Welcome display welcome
message WELCOME
Hello, Welcome to the Calabar Basketball Statistics Collector in the Welcome function and
them goes to the menu function (main menu function).

menu function starts

Enter an option from this menu

Enter 1 to start entering Team Info

Enter 2 Display Team info

Enter 0 to exit program

Reads user input choice

If the choice is greater 2 the following message will be displayed Please choose from the
options listed... "
Continue to display error message once entry is over 2.
If user choice is 0 the program goes to end function and displays message Goodbye
thanks for using the Calabar High School Basketball Statistics Collector and then closes.

If user choice is 1 user is brought to Teaminfo function.

menu function stops

20 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

Teaminfo function starts

User is prompted to enter opposing team name, variable Visitors[viz] is read and name stored,
user is prompted to enter number of home team members at game, reads input homenum, if
homenum is greater than twelve, display message More than league regulations else
continue and clear screen to statcol function menu.

statcol function starts

In statcol function, user enters option under variable stat after entering player jersey number
read jersey number input Home_playernum, Read input stat, If stat equal 1 to 12 program
goes to collector function.
statcol function pauses

collector function starts

if [stat] equals 1, if (FGM[Pnum] = 0) add two points to player score else add two points to
player score, add an attempt to score, and team score, display team score Calabar now has 2
points.

If [stat] equals 2, if (FGA[Pnum] = 0), program will prompt to enter amount of attempts just
now, multiply the number of attempts by one and add to player attempts (FGA[Pnum]), else, add
one attempt to player attempt and display team score Calabar still has 2 points.

If [stat] equal 3 add one free throw point to player score, to team score and display score
Calabar now has 3 points.

If [stat] equal 4, if (FTA[Pnum] = 0), program will prompt to enter amount of attempts just
now, multiply the number of attempts by one and add to player attempts, else, add one attempt to
player attempts and display team score Calabar still has 3 points.

If [stat] equal 5, if (TM[Pnum] = 0), program will add three points to player score, add to team
total score and display team score Calabar now has 6 points.

If [stat] equal 6, program will prompt to enter amount of attempts just now, multiply the
number of attempts by one and add to player attempts, else, add one attempt to player attempts
and display team score and display team score Calabar still has 6 points.

If [stat] equal 7, if (REBnum[Pnum] = 0), program will prompt to enter amount of rebounds
just now, multiply the number of rebounds by one and add to player rebounds, else, add one
rebound to player rebounds and display team score Calabar still has 6 points.
21 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

If [stat] equal 8, if (AST [Pnum] = 0), program will prompt to enter amount of assists just
now, multiply the number of assists by one and add to player assists, else, add one assist to
player assists and display team score Calabar still has 6 points.

If [stat] equal 9, if (BLK[Pnum] = 0), program will prompt to enter amount of blocks just
now, multiply the number of blocks by one and add to player blocks, else, add one block to
player blocks and display team score Calabar still has 6 points.

If [stat] equal 10, if (STL[Pnum] = 0), program will prompt to enter amount of steals just
now, multiply the number of steals by one and add to player steals, else, add one steal to player
steals and display team score Calabar still has 6 points.

If [stat] equal 11, if (PF[Pnum] = 0), program will prompt to enter amount of fouls just now,
multiply the number of fouls by one and add to player fouls, else, add one foul to player fouls
and display team score Calabar still has 6 points.

If [stat] equal 11, if (PF[Pnum] = 3), program will display message Player 23 needs to cool
off them fouls or he's in line for the bench!!!

If [stat] equal 11, if (PF[Pnum] = 4), program will display message One more of those and
player 23 is OFF!!!

If [stat] equal 11, if (PF[Pnum] = 5), program will display message Player 23 has to now
come OFF court, poor dude...

If [stat] equal 12, if (TO[Pnum] = 0), program will prompt to enter amount of turnovers just
now, multiply the number of turnovers by one and add to player turnovers, else, add one turnover
to player fouls and display team score Calabar still has 6 points.

If [stat] equal 0, program will go to menu function.

collector function breaks

statcol function starts

If user choice is 2 the program will go to broadsheet function

22 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

statcol function pauses

broadsheet function starts

broadsheet function displays message:


Enter 1 to display Calabar broad sheet
Enter 2 to go to return to top menu

Reads user input options, s


if options equal 1 any data available in broadsheet will be shown.

| Player # | Points | Rebounds | Assists | Blocks | Steals | Fouls | Turnovers | shots made |
shots attempted | FTM | FTA | TM | TA
______________________________________________________________
| 23 | 4 | 3 | 3 | 4 | 7 | 3 | 3 | 7 | 5 | 8 | 2 | 3 | 3 |

Program also prints broadsheet to text file.

else if options equal 2 program goes to STACKER function

else If options equal 3 program returns to menu function.

broadsheet function stops.

Source Code

//JESUS I THANK YOU FOR YOUR UNFAILING HELP, STRENGTH AND


GUIEDANCE!!!!!!!!!

23 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

//Sage loves Tyrell, He loves her too.

/*This programme was created and finished by Jevoun Benjamin Tyrell aka JBT. Sage aka
Giggles
on the 10th of March 2017*/

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <time.h>
#include <assert.h>
#include <windows.h>
#define TEAMmaxnum 12

//Kris-Ann loves Tyrell, He loves her too.

// MAIN FUNCTIONS DECLEARATIONS

int Welcome();
void end();
void hi();
int menu();
int menu2();
int notuse();
int Teaminfo();
int statcol();
int collector();
searcher ();
STACKER ();
int main();

//MAIN VARIABLES

int c,k /*welcome screen loop variables*/;


int Pnum,statpos;
int choice; //for quick exit
int PTS [90] /*points*/
,tFGM = 0 /* total goals made*/
24 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

,tFTM = 0 /*total frees made*/


,tTM = 0 /* total threes made*/
,REB [90]/*rebounds*/
,OREB[90]/*offensive rebounds*/
,DREB[90]/*defensive rebounds*/
,STL [90]/*steals*/
,PF [90]/*fouls*/
,AST [90]/*assists*/
,BLK [90]/*blocks*/
,TO [90]/*turnovers*/
,FGM [90]/*goals made*/
,FGA [90]/*goals attempted*/
,FTM [90]/*frees made*/
,FTA [90]/*frees attempted*/
,TM [90]/*3s made*/
,TA [90]/*3s attempted*/
,FGAnum[90]//field goals zero error prevention counter
,FTMnum[90]/*frees made zero error prevention counter*/
,FTAjm [90]/*frees attemted zero error prevention counter*/
,TMnum [90]/* three made zero error prevention counter*/
,TAnum [90]/* three attempted zero error prevention counter*/
,REBnum[90]/* rebound counter to stop zero error*/
,ASTnum[90]/*assists zero error prevention counter*/
,STLnum[90]/*steals zero error prevention counter*/
,PFnum [90]/*foul zero error prevention counter*/
,TCnum [90]/*turnover zero error prevention counter*/
,BLKnum[90]/*block zero error prevention counter*/;
int extime,options,totpoints/*for broad sheet*/;
int (Home_Playernum[100])[100]/*player jersey number*/;
char Visitors[90]/*Stores team name*/;
int viz=90;
int homenum,stat;//number of players for each team
char would,info;
char Home[] = "CALABAR HIGH SCHOOL";/*Stores team name*/
char hshort[] = "CALABAR";/*Stores team name*/
char Ho,HS;
int homename,entry;
int passcode = 32020161;
int matchtime = 90;
int Home_Players = 1; //counter for number of players on Home team
int Visitors_Players = 1; /*counter for number of players on Visiting team*/
25 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

int arr[10], num, i, n , pos =-1, beg, end, middle, found =0;

// MAIN FUNCTIONS

int contd(){

time_t(CurrentTime);
time(&CurrentTime);

system ("color 9e");


printf (" Today is: %s\n\n",ctime(&CurrentTime));

printf("\nEnter 'N' to discontinue the use of this programme\n");


printf("\nEnter 'Y' to continue\n");
scanf ("%s",&would);
system ("cls");
}

int Welcome()
{

system("cls");
for ( c = 1 ; c <= 6 ; c++ ){

printf(" ** ** \n");
printf(" ** * ** \n");
printf(" ** ** ** ** \n");
printf(" ** ** \n");
printf(" ** ** \n");

system("cls");
}

for ( c = 1 ; c <= 6 ; c++ ){

26 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

printf(" ******** \n");


printf(" ******** \n");
printf(" ** \n");
printf(" ***** \n");
printf(" ***** \n");
printf(" ** \n");
printf(" ******** \n");
printf(" ******** \n");

system("cls");
}

for ( c = 1 ; c <= 6 ; c++ ){

printf(" ** \n");
printf(" ** \n");
printf(" ** \n");
printf(" ** \n");
printf(" ** \n");
printf(" ******* \n");
printf(" ******* \n");

system("cls");
}

for ( c = 1 ; c <= 6 ; c++ ){

printf(" ***** \n");


printf(" *** \n");
printf(" ** \n");
printf(" ** \n");
printf(" ** \n");
printf(" *** \n");
printf(" ***** \n");

system("cls");
27 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

for ( c = 1 ; c <= 6 ; c++ ){

printf(" ******* \n");


printf(" ** ** \n");
printf(" ** ** \n");
printf(" ** ** \n");
printf(" ** ** \n");
printf(" ** ** \n");
printf(" ******* \n");

system("cls");
}

for ( c = 1 ; c <= 6 ; c++ ){

printf(" * * \n");
printf(" **** **** \n");
printf(" ** ** ** ** \n");
printf(" ** * ** \n");
printf(" ** ** \n");
printf(" ** ** \n");
printf(" ** ** \n");

system("cls");
}

for ( c = 1 ; c <= 6 ; c++ ){

printf(" ******** \n");


printf(" ******** \n");
printf(" ** \n");
printf(" ***** \n");
printf(" ***** \n");
printf(" ** \n");
printf(" ******** \n");
28 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

printf(" ******** \n");

system("cls");
}
printf (" WWWW WWWW EEEEEEEE LL CCCCC OOO M M
EEEEEEE \n");
printf (" WW W ww EEE LL C O O MM MM MM MM EEE
\n");
printf (" WW WW WW WW EEEEE LL C O O
MM M MM EEEEE \n");
printf (" WW WW EEE LL C O O MM
MM EEE \n");
printf (" W W EEEEEEEE LLLLLLLL CCCCC OOO
MM MM EEEEEEE \n");
system ("color 2e");
printf ("\n\n The %s Basketball Statistics Collector\n",&Home[Ho]);
}

int menu(){

system ("color 2e");

printf("\n\nEnter an option from this menu \n\n");

printf("\n\nEnter 1 to start entering Team Info.\n");

printf("Enter 2 Display Team info \n");

printf("\n\n\nEnter 0 to exit program \n\n");

scanf ("%d",&choice); //to choose to enter team data

if (choice > 2 ){
printf ("Please choose from the options listed... ");
}

system ("cls");
}

int menu2(){

29 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

system ("cls");

system ("color 2e");

printf("\n\nEnter an option from this menu \n\n");

printf("\n\nEnter 1 to start entering Team Info.\n");

printf("Enter 2 Display Team info \n");

printf("\n\n\nEnter 0 to exit program \n\n");

scanf ("%d",&choice); //to choose to enter team data

if (choice > 2 ){
printf ("Please choose from the options listed... ");
}

system ("cls");
}

void end(){
printf ("\n\n\n\nGoodbye thanks for using the Calabar High School Basketball Statistics
Collector\n");
}

int notuse(){
printf ("\n\n\n Ok bye I hope we can work together some day!!! =-)");
system ("color 5a");
return 0;
}

void hi(){

printf ("\n\n\nHello, Welcome to the %s Basketball Statistics Collector \n",&Home[Ho]);


printf ("Let's get in the game\n");
system ("pause");
system ("cls");
}

30 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

int Teaminfo(){

time_t(CurrentTime);
time(&CurrentTime);

FILE * Team;
Team = fopen("Team.txt","a+");

printf ("\n Enter the opposing team name \n\n");


scanf ("%s",&Visitors[viz]);
printf ("How many players are on the %s team?\n",&Home);
scanf ("%d",&homenum);

if (homenum > TEAMmaxnum){


printf ("More than league regulations");
system ("pause");
Teaminfo();
}
else (homenum < TEAMmaxnum);{
system ("cls");
system ("pause");
}

fprintf (Team,"This was the data received on %ld\n\n",time(&CurrentTime));


fprintf (Team,"The Opposing team to Calabar on %ld was,
%s.\n\n\n",time(&CurrentTime),&Visitors);
}

int statcol(){ //this function is called for the choice of


//the statistical data needed to be entered

do{

system ("cls");
system ("color 2e");
printf ("************************************************************\n");
printf ("* Good day!!! *\n");
printf ("* Enter player jersey number *\n");
printf ("************************************************************\n");
scanf ("%d",&Home_Playernum[Pnum]);

31 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

system ("cls");

printf (" ******************************************************************\n");


printf ("* 1-field goal made 2-field goal attempted 3-frees made 4-frees attempted *\n");
printf ("*5-threes made 6-threes attempted 7-rebounds made 8-assists made *\n");
printf ("*9-blocks made 10-steals made 11-fouls made 12-turnovers made *\n");
printf ( *0- to go to upper menu *\n");
printf ("*Enter the coressponding number to add the statictical point to the coressponding player.
*\n");
printf ("******************************************************************\n");
scanf ("%d",&stat);
system ("cls");
if ((stat < 0) || (stat >12));
{
printf ("*********************************************************\n");
printf ("* ERROR!!! *\n");
printf ("* *\n");
printf ("* *\n");
printf ("* Please enter one of the afore mentioned options *\n");
printf ("*********************************************************\n");
}

} while ((stat > 0 ) || (stat < 13));

int collector(){

// this function is to calculate and to place


// the data as according to player jersey number.

Teaminfo();

statcol();

do {
//continue stats collection

switch (stat){

32 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

case 1:

if (FGM/*goals made*/[Pnum]==0)
{
FGM/*goals made*/[Pnum] = FGM/*goals made*/[Pnum] + 2; FGA/*goals attempted*/[Pnum]
= FGA/*goals attempted*/[Pnum] + 1;
tFGM/*goals made*/ =tFGM/*goals made*/ + 2;
system ("pause");
}

else{
FGM/*goals made*/[Pnum] = FGM/*goals made*/[Pnum] + 2;
FGA/*goals attempted*/[Pnum] = FGA/*goals attempted*/[Pnum] + 1;
tFGM/*goals made*/ =tFGM/*goals made*/ + 2;
}

totpoints = tFGM/*goals made*/ + tFTM/*frees made*/ + tTM/*threes made*/;

printf ("\n%s now has %d points.\n",hshort,totpoints);


system ("pause");
break;

case 2:
if (FGA/*goals attempted*/[Pnum]==0){
printf ("\n Enter number of attemps just now...");
scanf ("%d",&FGAnum[Pnum]);
FGA/*goals attempted*/[Pnum] = FGAnum[Pnum] + FGA[Pnum];
printf ("\n%s is still at %d points.\n",hshort,totpoints);
system ("pause");
}

else {
printf ("\n Enter number of attemps just now...");
scanf ("%d",&FGAnum[Pnum]);
FGA/*goals attempted*/[Pnum] = FGA/*goals attempted*/[Pnum] + FGAnum[Pnum];
FGA/*goals attempted*/[Pnum] = FGA/*goals attempted*/[Pnum];
printf ("\n%s is still at %d points.\n",hshort,totpoints);
system ("pause");
}
break;

33 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

case 3:
if (FTM/*frees made*/[Pnum]==0)
{
printf ("\n Enter number of free throws just now...\n");
scanf ("%d",&FTMnum/*frees made counter to stop zero error*/[Pnum]);
FTM/*frees made*/[Pnum] = (FTMnum[Pnum] * 1);
FTA[Pnum]=FTA/*frees attempted*/[Pnum] + 1;
tFTM/*frees made*/ = tFTM/*frees made*/ + 1;
system ("pause");
}

else (FTM/*frees made*/[Pnum]>0);


{
FTM/*frees made*/[Pnum] = (FTMnum[Pnum] * 1);
FTA[Pnum]=FTA/*frees attempted*/[Pnum] + 1;
tFTM/*frees made*/ = tFTM/*frees made*/ + 1;
}

totpoints = tFGM/*goals made*/ + tFTM/*frees made*/ + tTM/*threes made*/;


printf ("\n%s now has %d points.\n",hshort,totpoints);
system ("pause");

break ;

case 4:

if (FTA/*frees attempted*/[Pnum]==0)
{
printf ("\n Enter number of free throws attempted just now ");
scanf ("%d",&FTAjm/*frees attempted counter to stop zero error*/[Pnum]);
FTA[Pnum]=FTA/*frees attempted*/[Pnum] + FTAjm[Pnum];
printf ("\n%s is still at %d points.\n",hshort,totpoints);
system ("pause");
}

else {
printf ("\n Enter number of free throws attempted just now...\n");
scanf ("%d",&FTAjm/*frees attempted counter to stop zero error*/[Pnum]);
FTA[Pnum]=FTA/*frees attempted*/[Pnum] + FTAjm[Pnum];
printf ("\n%s is still at %d points.\n",hshort,totpoints);
system ("pause");

34 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

}
break;

case 5:
if ((tTM/*total threes made*/==0) && (TM/*threes made*/[Pnum]==0))
{
printf ("\n Enter number of three pointers made just now...\n");
scanf ("%d",&TMnum /* three made counter to stop zero error*/[Pnum]);
TM/*threes made*/[Pnum] = (TMnum[Pnum]* 3);
TA/*threes attempted*/[Pnum]= TA/*threes attempted*/[Pnum] + 1;
tTM/*goals made*/ =tTM/*goals made*/ + 3;
system ("pause");
}

else {
printf ("\n Enter number of three made just now...\n");
scanf ("%d",&TMnum /* three made counter to stop zero error*/[Pnum]);
TM/*threes made*/[Pnum] = (TMnum[Pnum]* 3);
TA/*threes attempted*/[Pnum]= TA/*threes attempted*/[Pnum] + 1;
tTM/*goals made*/ =tTM/*goals made*/ + 3;
}

totpoints = tFGM/*goals made*/ + tFTM/*frees made*/ + tTM/*threes made*/;

printf ("\n%s now has %d points.\n",hshort,totpoints);


system ("pause");
}
break;

case 6:

if (TA/*threes attempted*/[Pnum]==0)
{
printf ("\n Enter number of threes attempted just now...\n");
scanf ("%d",&TAnum /* three attempted counter to stop zero error*/[Pnum]);
TA/*threes attempted*/[Pnum]= TA/*threes attempted*/[Pnum] + TAnum[Pnum];
printf ("\n%s is still at %d points.\n",hshort,totpoints);
system ("pause");
}

else {

35 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

printf ("\n Enter number of threes attempted just now...\n");


scanf ("%d",&TAnum /* three attempted counter to stop zero error*/[Pnum]);
TA/*threes attempted*/[Pnum]= TA/*threes attempted*/[Pnum] + TAnum[Pnum];
printf ("\n%s is still at %d points.",hshort,totpoints);
system ("pause");
}
break;

case 7:

if (REB/*rebounds made*/[Pnum]==0)
{
printf ("\n Enter the number of rebounds just now...\n");
scanf ("%d",&REBnum/* rebound counter to stop zero error*/);
REB/*rebounds made*/[Pnum] = REB/*rebounds made*/[Pnum] + REBnum[Pnum];
printf ("\n%s is still at %d points.\n",hshort,totpoints);
system ("pause");
}

else {
printf ("\n Enter the number of rebounds just now...\n");
scanf ("%d",&REBnum/* rebound counter to stop zero error*/);
REB/*rebounds made*/[Pnum] = REB/*rebounds made*/[Pnum] + REBnum[Pnum];
printf ("\n%s is still at %d points.\n",hshort,totpoints);
system ("pause");
}

case 8:

if (AST/*assists made*/[Pnum]==0){
printf ("\n Enter the number of assists made by player just now...\n");
scanf ("%d",&ASTnum/*assists counter to stop zero errors*/[Pnum]);
AST/*assists made*/[Pnum] = AST[Pnum] + ASTnum[Pnum];
printf ("\n%s is at %d points.\n",hshort,totpoints);
system ("pause");
}

else {
printf ("\n Enter the number of assists made by player just now...\n");
scanf ("%d",&ASTnum/*assists counter to stop zero errors*/[Pnum]);
AST/*assists made*/[Pnum] = AST[Pnum] + ASTnum[Pnum];
36 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

printf ("\n%s is at %d points.\n",hshort,totpoints);


system ("pause");
}
break;

case 9:

if (BLK/*blocks made*/[Pnum]==0)
{
printf ("\n Enter the number of blocks made by player just now...\n");
scanf ("%d",&BLKnum /*block counter*/[Pnum]);
BLK/*blocks made*/[Pnum] = BLKnum [Pnum] + BLK[Pnum];
printf ("\n%s is at %d points.\n",hshort,totpoints);
system ("pause");
}

else {
printf ("\n Enter the number of blocks made by player just now...\n");
scanf ("%d",&BLKnum /*block counter*/[Pnum]);
BLK/*blocks made*/[Pnum] = BLKnum [Pnum] + BLK[Pnum];
printf ("\n%s is at %d points.\n",hshort,totpoints);
system ("pause");
}
break;

case 10:
if (STL/*steals made*/[Pnum] == 0){
printf ("\n Enter the number of steals made by player just now...\n");
scanf ("%d",&STLnum /*steals counter*/[Pnum]);
STL/*steals made*/[Pnum] = STLnum [Pnum] + STL[Pnum];
printf ("\n%s is still at %d points.\n",hshort,totpoints);
system ("pause");
}

else{
printf ("\n Enter the number of steals made by player just now...\n");
scanf ("%d",&STLnum /*steals counter*/[Pnum]);
STL/*steals made*/[Pnum] = STLnum [Pnum] + STL[Pnum];
printf ("\n%s is still at %d points.\n",hshort,totpoints);
system ("pause");
}
37 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

break;

case 11:

if(PF/*fouls made*/[Pnum]==0)
{
printf ("\n Enter the number of fouls made by player just now...\n");
scanf ("%d",&PFnum /*foul counter*/[Pnum]);
PF/*fouls made*/[Pnum] = PFnum [Pnum] + PF[Pnum];
printf ("\n%s is still at %d points.\n",hshort,totpoints);
system ("pause");
}

else {
printf ("\n Enter the number of fouls made by player just now...\n");
scanf ("%d",&PFnum /*foul counter*/[Pnum]);
PF/*fouls made*/[Pnum] = PFnum [Pnum] + PF[Pnum];
printf ("\n%s is still at %d points.\n",hshort,totpoints);
system ("pause");
}

if (PF/*fouls made*/[Pnum] == 3);


{
printf ("\n Player %d needs to cool off them fouls or he's in line for the
bench!!!\n",Home_Playernum[Pnum]);
system ("pause");
}

if(PF/*fouls made*/[Pnum] == 4);


{
printf ("\n One more of those and player %d is OFF!!!\n",Home_Playernum[Pnum]);
system ("pause");
}
if (PF/*fouls made*/[Pnum] == 5);{
printf ("\n Player %d has to now come OFF court, poor dude...\n",Home_Playernum[Pnum]);
system ("pause");
}

break;

case 12:
38 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

if (TO/*turnovers made*/[Pnum]==0){
printf ("\n Enter the number of fouls made by player just now...\n");
scanf ("%d",&TCnum /*turnover counter*/[Pnum]);
TO/*turnovers made*/[Pnum] = TCnum [Pnum] + TO[Pnum];
printf ("\n%s is still at %d points.\n",hshort,totpoints);
system ("pause");
}
else{printf ("\n Enter the number of fouls made by player just now...\n");
scanf ("%d",&TCnum /*turnover counter*/[Pnum]);
TO/*turnovers made*/[Pnum] = TCnum [Pnum] + TO[Pnum];
printf ("\n%s is still at %d points.\n",hshort,totpoints);
system ("pause");
}

if (TO/*turnovers made*/[Pnum] > 5 ){


printf ("This dude thoe!!!! Player # %d is a danger to the team!",Home_Playernum[Pnum]);
printf ("This player is now out of the game...");
system ("pause");
}
break;

case 0:
{
system ("clr");
menu();
}

} //stat case close


//continue stats collection

} while ((stat!= 0) && (stat <= 12));

if (stat >= 13) {


printf ("enter the options above\n");
system ("pause");
}

else
{
system ("cls");
}

39 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

}// collector function close.

int broadsheet(){

printf ("Enter 1 to display %s broad sheet\n",&hshort);


printf ("Enter 2 to view stack position of top player in points\n\n");
printf (Enter 3 to go exit top menu....\n\n\n)
scanf ("%d",&options);

switch (options)
{
case 1:{ // case to display broadsheet

printf ("Here is the table for the players of the %s team....\n",hshort);


system ("pause");
printf ("| Player # | Points | Rebounds | Assists | Blocks | Steals | Fouls | Turnovers | shots made |
shots attempted | FTM | FTA | TM | TA |\n");
system ("pause");
for(Pnum=0;Pnum <=homenum ; Pnum++){
Home_Players--;
for(statpos=0;statpos<=14;statpos++){
printf ("__________________________________________________________\n");
printf ("| %d | %d | %d | %d | %d | %d | %d | %d | %d | %d | %d | %d | %d | %d |\n"

,Home_Playernum[Pnum]
,PTS/*points made*/[Pnum]
,REB/*rebounds made*/[Pnum]
,AST/*assists made*/[Pnum]
,BLK/*blocks made*/[Pnum]
,STL/*steals made*/[Pnum]
,PF/*fouls made*/[Pnum]
,TO/*turnovers made*/[Pnum]
,FGM/*goals made*/[Pnum]
,FGA/*goals attempted*/[Pnum]
,FTM/*frees made*/[Pnum]
,FTA/*frees attempted*/[Pnum]
,TM/*3s made*/[Pnum]
,TA/*3s attempted*/[Pnum]);

}//for loop enclosure for stats column/index number

40 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

}//for loop enclosure for player number

// apart of case to display broadsheet, print to txt file.

time_t(CurrentTime);
time(&CurrentTime);

FILE * Team;
Team = fopen("Team.txt","a+");

fprintf(Team,"Today is: %s\n\n",ctime(&CurrentTime));


fprintf(Team,"This was the data received on %s\n\n\n",ctime(&CurrentTime));

fprintf (Team,"Here is the table for the players of the %s team....\n",Home[homename]);


fprintf (Team,"| Player # | Points | Rebounds | Assists | Blocks | Steals | Fouls | Turnovers | shots
made | shots attempted | FTM | FTA | TM | TA |\n");

for(Pnum=0;Pnum <=5 ; Pnum++){


Home_Players--;
for(statpos=0;statpos<=14;statpos++){
Home_Players--;
fprintf
(Team,"____________________________________________________________________\n");
fprintf (Team,"| %d | %d | %d | %d | %d | %d | %d | %d | %d | %d | %d | %d | %d | %d |\n"

,Home_Playernum[Pnum]
,PTS/*points made*/ [Pnum]
,REB/*rebounds made*/[Pnum]
,AST/*assists made*/[Pnum]
,BLK/*blocks made*/[Pnum]
,STL/*steals made*/[Pnum]
,PF/*fouls made*/[Pnum]
,TO/*turnovers made*/[Pnum]
,FGM/*goals made*/[Pnum]
,FGA/*goals attempted*/[Pnum]
,FTM/*frees made*/[Pnum]
,FTA/*frees attempted*/[Pnum]
,TM/*3s made*/[Pnum]
,TA/*3s attempted*/[Pnum] );
}
41 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

}//file for loop enclosure


fclose (Team);

}
break; //options #1 breaker

case 2:
{
searcher ();
STACKER ();
}
break;// options #2 breaker

} //options breaker locking brace

} // locking brace for broadsheet

void searcher () {

printf("\n Enter the number of elements in the array: ");


scanf ("%d", &n);
printf (" \n Enter the elements: ");
for(i=0;i<n;i++)
{
scanf("%d", &arr[i]);
}
printf("\n Enter the number that has to be searched: " );
scanf ("%d", &num);
beg = 0, end = n-1;
while (beg <end)
{
mid= (beg+ end)/2;
if (arr[middle] == num)
{
printf("\n %dis present in the array at position = %d", num, middel);
found=1;
break;
}
if (arr[middle]>num)
{

42 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

end = middle-1;
}
else if (arr[middle] < num)
beg = mid+1;
}
if ( beg > end &&found == 0)
{
printf("\n %d DOES NOT EXIST IN THE ARRAY",num);
}
getch();
return 0;
}
struct stack
{
int stk[MAXSIZE];
int top;
};
typedef struct stack STACKUP;
STACKUP s;

void push(void);
int pop(void);
void display(void);

void STACKER ()
{
int stkchoice;
int option = 1;
s.top = -1;

printf ("STACK OPERATION\n");


while (option)
{
printf ("------------------------------------------\n");
printf (" 1 --> PUSH \n");
printf (" 2 --> POP \n");
printf (" 3 --> DISPLAY \n");
printf (" 4 --> EXIT \n");
printf ("------------------------------------------\n");

printf ("Enter your choice\n");

43 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

scanf ("%d", &stkchoice);


switch (stkchoice)
{
case 1:
push();
break;
case 2:
pop();
break;
case 3:
display();
break;
case 4:
return;
}
fflush (stdin);
printf ("Do you want to continue(Type 0 or 1)?\n");
scanf ("%d", &option);
}
}
/* Function to add an element to the stack */
void push ()
{
int num;
if (s.top == (MAXSIZE - 1))
{
printf ("Stack is Full\n");
return;
}
else
{
printf ("Enter the element to be pushed\n");
scanf ("%d", &num);
s.top = s.top + 1;
s.stk[s.top] = num;
}
return;
}
/* Function to delete an element from the stack */
int pop ()
{
44 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

int num;
if (s.top == - 1)
{
printf ("Stack is Empty\n");
return (s.top);
}
else
{
num = s.stk[s.top];
printf ("poped element is = %dn", s.stk[s.top]);
s.top = s.top - 1;
}
return(num);
}
/* Function to display the status of the stack */
void display ()
{
int i;
if (s.top == -1)
{
printf ("Stack is empty\n");
return;
}
else
{
printf ("\n The status of the stack is \n");
for (i = s.top; i >= 0; i--)
{
printf ("%d\n", s.stk[i]);
}
}
printf ("\n");
}

// MAIN PROGRAM

int main()
{
45 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

time_t(CurrentTime);
time(&CurrentTime);
do{
contd();

switch (would){

case 'Y':
{ // case for "yes" if userwishes to continue use.
Welcome();

hi();

menu();

do{ // do main calculations here while inside iof choices shown.

switch (choice){

case 1: /*When choice 1 is entered, this should go the collector function outlined above*/
{
collector();
} // collector case locking brace
break;

case 2: //choice case 2 start


{
broadsheet();
}
break; //choice case 2 break

case 0:
{
end();
} break;
}

}
while (choice!= 0);
if (choice!= 0 ){
end ();
46 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

}
break;
} //would use case close

case 'y': // for common y


{ // case for "yes" if user wishes to continue use.
Welcome();

hi();

menu();

do{ // do main calculations here while inside iof choices shown.

switch (choice){

case 1: /*When choice 1 is entered, this should go the collector function outlined above*/
{
collector();
} // collector case locking brace
break;

case 2: //choice case 2 start


{
broadsheet();
}
break; //choice case 2 break

case 0:
{
end();
} break;
}
}
while (choice!= 0);
if (choice!= 0 ){
end ();
}
break;
} //would use case close

47 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

case'N':
{
notuse();
end ();
return 0;
}

case'n':
{
notuse();
end ();
return 0;
}
}
}while ((would = 'Y') || (would = 'y') || (would = 'N') || (would = 'n'));
} //end of main function/program

48 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

Output Screens
Figure 1: When program has started

Figure 2: When user chooses N program ends.

Figure 3: When user chooses Y program continues.

49 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

Figure 4: When user goes to main menu.

Figure 5: When user goes to start entering info by pressing 1.

Figure 6: When user enters more than 12 players.

Figure 7: When user enters 12 players.

50 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

Figure 8: When user enters random jersey number.

Figure 9: When user uses function 1.

Figure 10: When user enters function 2.

Figure 11: When user enters function 3.

Figure 12: When user enters function 4.

51 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

Figure 13: When user enters function 5.

Figure 14: When user enters random jersey number.

Figure 15: When user views broadsheet.

52 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

53 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

Test Plan

Error
Variable Name Variable Type Accepted Data Purpose
statement
Enter a
To store and display VALID value,
Home_Playernum integer 23 the players jersey the data input
number is
inappropriate.
(If more than
Stores number of
12) more than
homenum integer 1 12 players for home
league
team
regulations
Will continue
To store the users to display
options integer 1,2 choice in broadsheet options until
function correctly
input.
To store and display Please choose
the corresponding from the
choice integer 1 or 2 or 0
menu of choice in options
the menu function listed...
ERROR!!!

To store users Please enter


stat integer 1 12 or 0 choice for statcol one of the
function menu afore
mentioned
options
To store and display Enter a
Visitors[viz] Character Jamaica College the opposing team VALID team
name name.
To store users
Will continue
choice to initially
to display
check if the user
would Character Y or y or N or n options until
would like continue
correctly
use of the program at
input.
first boot.

54 | P a g e
Jevoun Tyrell Teacher: Ms. Nugent

Appendix

Interview questions

What are the features that should be incorporated in the broadsheet?

______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

Is an output similar to the broadsheet better suited for you or a list format of the data?

______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

Is there any special feature that you would like to see in the system, to either brand it as yours or
make it unique?
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

55 | P a g e

Вам также может понравиться