2. 1
Contents Pages
Problem Statement 2
Functional Requirements 3
Non-Functional Requirements 4
Psuedocode 5-23
Technical Documentation 24
Program Code 25-35
File Design 36
Whitebox Testing 37
Results of Whitebox Testing 38-39
Functional Testing 40-43
User Documentation
3. 2
PROBLEM STATEMENT
A new Trinidad and Tobago game show called “What Yuh Know” recently started airing on the
CNC 3 channel and has experienced difficulties keeping track of all contestants and their
information who participated in the period of April to June on paper, manually writing up the
number of questions answered correctly, calculating their equivalent points, converting the
points into cash (USD) with the option to check the equivalent value (in TTD) and stating
whether or not the contestant has moved on to the next session. This is mainly due to human
error when writing down player information / records and miscalculations.
At round one, every (4) questions answered correctly awards 5 points, at round two, every (4)
questions answered correctly awards 10 points and at round three, every (4) questions answered
correctly awards 20 points. At the end of the session, all the points awarded from the three
rounds will be added. Furthermore, every 20 points the contestant has, is equivalent to a cash
amount of USD $5.00 which can then be converted to TTD, using the formula (𝑥 * 6.79660).
Finally, it will be decided if the contestant has qualified to enter the next session. At least 120
points are required to advance to the next session.
In order to help this new game show, a program has been created to function as a database to
easily keep track of its contestants for the months of April, May, June. The program has various
tasks such as adding new contestants to the database, viewing all records (report), sorting the
records, exporting the data to an external file, importing data from external file.
4. 3
FUNCTIONAL REQUIREMENTS
This new digital system requires certain function requirements to correct issues identified in the
old system and increase its overall performance and efficiency.
Adding a Contestant
The new system must be able to add contestants and their respective information to the database.
Such information recorded would include the contestant’s ID, both first and last name and the
month they participated in.
The system will also record the number of questions answered correctly for each round and
calculate the number of points earned at each round as well as the overall number of points at the
end of the three rounds. It calculates the cash earned via converting the points to USD and can
also calculate its value in TTD (optional). Finally, this new system decides whether or not the
contestant has advanced to the next session.
Display All Records
This system must be able to generate and present reports of each contestant’s relevant
information from the database accurately.
Sort All Records
The system should be able to sort the records in the database in descending order.
Exporting Records
The new system should be able to export the reports from the database to an external file.
6. 5
NON-FUNCTIONAL REQUIREMENTS
Apart from functions that are absolutely necessary for the new system, some non-essential
functions are also required as they improve the overall quality of the system.
User-Friendly Interface
This system must be user friendly to ensure a smooth transition from the old system. It must be
designed so that any user can easily navigated the menu of the program.
Data-Validation
There must be some form of validation to all data entered into the system. This is to ensure that
there is a minimum number of errors and incorrect data entered into the contestant log.
Proper User-Prompts
The appropriate messages should be displayed to the user at appropriate times to guide the user
on what to input at the correct time.
7. 6
PSUEDOCODE
STRUCT member
int contestantID
char contestantFName[20], contestantLName[20], monthOfParticipation[3]
int noCorrectAns1, noCorrectAns2, noCorrectAns3
int totalPtsEarned1, totalPtsEarned2, totalPtsEarned3, overallPts
int cashEarned
float cashEarnedTT
DECLARE const int recnumber = 30
DECLARE member contestantRec[recnumber]
DECLARE int recNo = 0
Narrative Description:
This procedure allows the user to add a contestant’s record to the Log.
FUNCTION addContestant ()
BEGIN
DECLARE char response
DECLARE int flag = 0
DECLARE int tempNum, tempNum1, tempNum2, tempNum3 = 0
DECLARE char tempVar[20]
DECLARE char acceptable
8. 7
OUTPUT ("| #################/** ADD NEW CONTESTANT **/#################### |")
OUTPUT ("|----------------------------------------------------------------------------------------------|")
acceptable = 'N'
do
begin
OUTPUT ("Please Enter Contestant ID: ")
READ (tempVar)
if (strlen (tempVar) != 4) then
acceptable = 'N'
OUTPUT ("The contestant's ID consists of only (4) digits!”)
else
acceptable = 'Y'
end if
while (acceptable == 'N')
contestantRec[recNo].contestantID = atoi(tempVar)
acceptable = 'N'
do
begin
OUTPUT ("Please Enter First Name: ")
READ (tempVar)
if (strlen (tempVar) > 20) then
acceptable = 'N'
OUTPUT ("First Name is Too Long! MUST be no longer than (20) characters!")
else
acceptable = 'Y’
end if
while (acceptable == 'N')
strcpy (contestantRec[recNo].contestantFName,tempVar)
9. 8
acceptable = 'N'
do
begin
OUTPUT ("Please Enter Last Name: ")
READ (tempVar)
if (strlen (tempVar) > 20) then
acceptable = 'N'
OUTPUT ("Last Name is Too Long! MUST be no longer than (20) characters!")
else
acceptable = 'Y'
end if
while (acceptable == 'N')
strcpy (contestantRec[recNo].contestantLName,tempVar)
acceptable = 'N'
do
begin
OUTPUT ("Please Enter Month of Participation: ")
READ (tempVar)
if (strlen (tempVar) == 3) then
acceptable = 'Y'
else
OUTPUT (“Please enter the first THREE letters of the Corresponding Month!
end if
while (acceptable == 'N')
strcpy (contestantRec[recNo].monthOfParticipation,tempVar)
10. 9
acceptable = 'N'
do
begin
OUTPUT ("Please Enter Number of Correct Round 1 Answers: ")
READ (tempNum1)
if (tempNum1 > 20) then
OUTPUT ("ERROR! There are only (20) Questions at the First Round!")
else
acceptable = 'Y'
end if
while (acceptable == 'N')
contestantRec[recNo].noCorrectAns1 = tempNum1
acceptable = 'N'
do
begin
OUTPUT ("Please Enter Number of Correct Round 2 Answers: ")
READ (tempNum2)
if (tempNum2 > 20) then
OUTPUT ("ERROR! There are only (24) Questions at the First Round!")
else
acceptable = 'Y'
end if
while (acceptable == 'N')
contestantRec[recNo].noCorrectAns2 = tempNum2
11. 10
acceptable = 'N'
do
begin
OUTPUT ("Please Enter Number of Correct Round 3 Answers: ")
READ (tempNum3)
if (tempNum3 > 20) then
OUTPUT ("ERROR! There are only (16) Questions at the First Round!")
else
acceptable = 'Y'
end if
while (acceptable == 'N')
contestantRec[recNo].noCorrectAns3 = tempNum3
contestantRec[recNo].totalPtsEarned1 = (contestantRec[recNo].noCorrectAns1 / 4) * 5
contestantRec[recNo].totalPtsEarned2 = (contestantRec[recNo].noCorrectAns2 / 4) *10
contestantRec[recNo].totalPtsEarned3 = (contestantRec[recNo].noCorrectAns3 / 4) *20
contestantRec[recNo].overallPts = contestantRec[recNo].totalPtsEarned1 +
contestantRec[recNo].totalPtsEarned2 + contestantRec[recNo].totalPtsEarned3
OUTPUT ("OVERALL POINTS EARNED: ",contestantRec[recNo].overallPts)
contestantRec[recNo].cashEarned = (contestantRec[recNo].overallPts / 20) * 5
OUTPUT ("CASH EARNED IN USD: USD $ ",contestantRec[recNo].cashEarned)
12. 11
OUTPUT ("Would you like to convert cash into TTD? Enter 'Y' for yes or 'N' for no: ")
READ (response)
if (response == 'Y') then
contestantRec[recnumber].cashEarnedTT = contestantRec[recNo].cashEarned * 6.79660
OUTPUT ("CASH EARNED IN TTD: TTD",contestantRec[recNo].cashEarnedTT);
else
OUTPUT ("CASH EARNED IN TTD: TTD N/A")
end if
OUTPUT ("**************************************************************")
recNo ++
system ("pause")
system ("cls")
END add player
13. 12
Narrative Description:
This procedure allows the user to display All stored records.
FUNCTION viewALL ()
BEGIN
DECLARE int x = 0
OUTPUT(“|--------------------------------------------------------------------------------------------|”)
OUTPUT ("| ###########/** RECORDS OF All CONTESTANTS!! **/########### |")
OUTPUT ("|--------------------------------------------------------------------------------------------|")
for (x = 0; x < recNo; x++)
begin
OUTPUT("*** --------------- _CONTESTANT'S RECORD_ --------------- ***")
OUTPUT(" _________________________________________________________")
OUTPUT(" |-----**Registeration Information of Contestant!!**-----|")
OUTPUT(" |** Contestant's ID: ",contestantRec[x].contestantID)
OUTPUT(" |** Contestant's First Name: ",contestantRec[x].contestantFName)
OUTPUT(" |** Contestant's Last Name: ",contestantRec[x].contestantLName)
OUTPUT(" |** Contestant's Month of Participation: ",contestantRec[x].monthOfParticipation)
OUTPUT(" |-----**NUMBER OF CORRECT ANSWERS AT EACH ROUND!!**-----|")
OUTPUT(" |** Round 1 Correct Anwers: ",contestantRec[x].noCorrectAns1)
OUTPUT(" |** Round 2 Correct Anwers: ",contestantRec[x].noCorrectAns2)
OUTPUT(" |** Round 3 Correct Anwers: ",contestantRec[x].noCorrectAns3)
14. 13
OUTPUT(" |--------**TOTAL POINTS EARNED AT EACH ROUND!!**--------|")
OUTPUT(" |** Round 1 Points: ",contestantRec[x].totalPtsEarned1)
OUTPUT(" |** Round 2 Points: ",contestantRec[x].totalPtsEarned2)
OUTPUT(" |** Round 3 Points: ",contestantRec[x].totalPtsEarned3)
OUTPUT(" |*******************************************************")
OUTPUT(" |** Overall Points: ",contestantRec[x].overallPts)
OUTPUT(" |** Cash Earned In USD: $",contestantRec[x].cashEarned)
OUTPUT(" |** Cash Earned In TTD: $",contestantRec[x].cashEarnedTT)
OUTPUT(" |*******************************************************|")
OUTPUT(" |------**QUALIFICATION STATUS FOR NEXT SESSION!!**------|")
if (contestantRec[x].overallPts >= 110) then
OUTPUT(" |** Status: QUALIFIED")
else
OUTPUT(" |** Status: UNQUALIFIED!")
OUTPUT(" |** ATLEAST 120 points is required to advance! **")
OUTPUT(" |########~~~~~~~#######________#########~~~~~~~~~#######|nnn")
endif
system("pause")
system("cls")
END display all
15. 14
Narrative Description:
This procedure sorts the recorded dada in descending order via the bubble sort method.
FUNCTION bubbleSort ()
BEGIN
DECLARE int i, j, flag = 1
int temp_contestantID
char temp_contestantFName[20], temp_contestantLName[20], temp_monthOfParticipation[3]
int temp_noCorrectAns1, temp_noCorrectAns2, temp_noCorrectAns3
int temp_totalPtsEarned1, temp_totalPtsEarned2, temp_totalPtsEarned3, temp_overallPts
int temp_cashEarned
float temp_cashEarnedTT
OUTPUT ("==================/** SORTING RECORDS **/=================")
OUTPUT ("------------------------------------------------------------------------------------------------")
for (i = 1PRINT (i <= recNo) && flagPRINT i++)
begin
flag = 0PRINT
for (j = 0PRINT (j < recNo - 1)PRINT j++)
if (contestantRec[j + 1].overallPts > contestantRec[j].overallPts)
strcpy(temp_contestantID,contestantRec[j].contestantID)
strcpy(contestantRec[j].contestantID, contestantRec[j+1].contestantID)
strcpy(contestantRec[j+1].contestantID, temp_contestantID)
18. 17
Narrative Description;
This procedure exports the currently stored data to a file.
FUNCTION exportData()
BEGIN
system ("cls")
FILE*outputfile
OUTPUT ("=================== EXPORTING RECORDS ====================")
OUTPUT ("---------------------------------------------------------------------------------------------------")
outputfile = fopen ("Exported Data.txt","w+"
19. 18
for (int x = 0 PRINT x < recNo PRINT x++)
OUTPUT (outputfile," ",contestantRec[x].contestantID)
OUTPUT (outputfile," ",contestantRec[x].contestantFName)
OUTPUT (outputfile," ",contestantRec[x].contestantLName)
OUTPUT (outputfile," ",contestantRec[x].monthOfParticipation)
OUTPUT (outputfile," ",contestantRec[x].noCorrectAns1)
OUTPUT (outputfile," ",contestantRec[x].noCorrectAns2)
OUTPUT (outputfile," ",contestantRec[x].noCorrectAns3)
OUTPUT (outputfile," ",contestantRec[x].totalPointsEarned1)
OUTPUT (outputfile," ",contestantRec[x].totalPointsEarned2)
OUTPUT (outputfile," ",contestantRec[x].totalPointsEarned3)
OUTPUT (outputfile," ",contestantRec[x].overallPts)
OUTPUT (outputfile," ",contestantRec[x].cashEarned)
OUTPUT (outputfile," ",contestantRec[x].cashEarnedTT)
OUTPUT (" #####/* Exporting Completed!!! */##### ")
CLOSE (outputfile)
system ("pause")
system ("cls")
END export
20. 19
Narrative Description:
This procedure imports data from a designated file on the system to be stored as the currently stored
data.
FUNCTION importData()
BEGIN
System ("cls")
int x
OUTPUT ("==================== IMPORTING RECORDS ===================")
OUTPUT ("---------------------------------------------------------------------------------------------------")
FILE * inputfile
inputfile = fopen ("Exported Data.txt","r+")
23. 22
Narrative Description:
This procedure manages the main menu of the program.
int main (void)
BEGIN
char choice
do
Intro_Screen();
OUTPUT ("-----------------------------------------")
OUTPUT (" | MAIN MENU | ")
OUTPUT ("-----------------------------------------")
OUTPUT ("| 1. Add New Contestant | ")
OUTPUT ("| 2. View All Records REPORT | ")
OUTPUT ("| 3. Sort Records | ")
OUTPUT ("| 4. Export ALL Records | ")
OUTPUT ("| 5. Import Data from file | ")
OUTPUT ("| 6. Exit | ")
OUTPUT ("-----------------------------------------")
READ (" ",choice)
switch (choice)
25. 24
TECHNICAL DOCUMENTATION
Author: Laquando Young System/Program: Game
Show Calculator
Date: 06/04/2022
Diagram ID: 2.1 Name: What Yuh Know
INPUT
1: Registration
Information
2: Correctly
Answered
Questions
3: Yes or No
OUTPUT
1: Contestant’s
ID, First Name,
Last Name,
Month
Participated
2: Number of
Questions
Answered
Correctly, Total
Points Earned
at Each Round,
Overall Points
Earned, Cash in
USD
3: Cash Earned
in TTD, Status
(Advanced or
Not)
PROCESS
1: Stores Registration
Information
2: Stores Correctly
Answered Questions
Calculates Total
Points Earned at each
Round as well as the
Overall Points
Converts Points to
USD
3: Calculates the cash
earned in TTD using
the USD to TTD
conversion method.
Stores the
contestant Status
26. 25
PROGRAM CODE
// This Program was written by Laquando Young.
/* Purpose: This program keeps track of all contestants' records from a game show, calculating
their equivalent points, converting the points to cash in USD with the option to check the
equivalent value in TTD and stating whether or not the contestant moved on to the next session.
*/
// Date: 06/04/2022
#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
//###############################################################################################
################################
typedef struct {
int contestantID;
char contestantFName[20], contestantLName[20], monthOfParticipation[3];
int noCorrectAns1, noCorrectAns2, noCorrectAns3;
int totalPtsEarned1, totalPtsEarned2, totalPtsEarned3, overallPts;
int cashEarned;
float cashEarnedTT;
} member;
const int recnumber = 30;
member contestantRec[recnumber];
int recNo = 0;
//#########################################################################@@@@@@@@@@@@@@@@@@@###
################################
// start of add player
void addContestant () {
char response;
int flag = 0;
int tempNum, tempNum1, tempNum2, tempNum3 = 0;
char tempVar[20];
char acceptable;
system("cls");
27. 26
printf("| #########################/** ADD NEW CONTESTANT **/######################### |n");
printf("|--------------------------------------------------------------------------------
|n");
// The following lines promts the user to enter the Contestant's ID then prints it out.
acceptable = 'N';
do{
printf("Please Enter the Contestant's ID: ");
scanf ("%s",tempVar);
if (strlen(tempVar) != 4){
acceptable = 'N';
printf("The contestant's ID consists of only (4) digits!n");
}else{
acceptable = 'Y';
}
}while (acceptable == 'N');
contestantRec[recNo].contestantID = atoi(tempVar);
// The following lines promts the user to enter the Contestant'a First Name then prints it
out.
acceptable = 'N';
do{
printf("Please Enter First Name: ");
scanf ("%s",tempVar);
if (strlen(tempVar) > 20){
acceptable = 'N';
printf("First Name is Too Long! MUST be no longer than (20) characters!n");
}else{
acceptable = 'Y';
}
}while (acceptable == 'N');
strcpy (contestantRec[recNo].contestantFName,tempVar);
// The following lines promts the user to enter the Contestant'a Last Name then prints it
out.
acceptable = 'N';
do{
printf("Please Enter Last Name: ");
scanf ("%s",tempVar);
if (strlen(tempVar) > 20){
acceptable = 'N';
printf("Last Name is Too Long! MUST be no longer than (20) characters!n");
}else{
acceptable = 'Y';
}
}while (acceptable == 'N');
strcpy (contestantRec[recNo].contestantLName,tempVar);
28. 27
// The following lines promts the user to enter the Month the Contestant participated in the
game and prints it out.
acceptable = 'N';
do{
printf("Please Enter Month of Participation: ");
scanf ("%s",tempVar);
if (strlen(tempVar) == 3){
acceptable = 'Y';
}else{
printf("Please Enter the first THREE letters of the Corresponding Month!n");
}
}while (acceptable == 'N');
strcpy (contestantRec[recNo].monthOfParticipation,tempVar);
/* The following lines promts the user to enter the Number of correct questions answered by
the contestant in each
round and prints it out. */
acceptable = 'N';
do{
printf("Please Enter Number of Correct Round 1 Answers: ");
scanf ("%d",&tempNum1);
if (tempNum1 > 20){
printf("ERROR! There are only (20) Questions at the First Round!n");
}else{
acceptable = 'Y';
}
}while (acceptable == 'N');
contestantRec[recNo].noCorrectAns1 = tempNum1;
acceptable = 'N';
do{
printf("Please Enter Number of Correct Round 2 Answers: ");
scanf ("%d",&tempNum2);
if (tempNum2 > 24){
printf("ERROR! There are only (24) Questions at the Second Round!n");
}else{
acceptable = 'Y';
}
}while (acceptable == 'N');
contestantRec[recNo].noCorrectAns2 = tempNum2;
acceptable = 'N';
do{
printf("Please Enter Number of Correct Round 3 Answers: ");
scanf ("%d",&tempNum3);
if (tempNum3 > 16){
printf("ERROR! There are only (16) Questions at the Third Round!n");
}else{
acceptable = 'Y';
}
}while (acceptable == 'N');
contestantRec[recNo].noCorrectAns3 = tempNum3;
29. 28
// The following lines calculates the total points a contestant makes in each round and
prints it out.
contestantRec[recNo].totalPtsEarned1 = (contestantRec[recNo].noCorrectAns1 / 4) * 5 ;
contestantRec[recNo].totalPtsEarned2 = (contestantRec[recNo].noCorrectAns2 / 4) * 10;
contestantRec[recNo].totalPtsEarned3 = (contestantRec[recNo].noCorrectAns3 / 4) * 20;
// The following lines calculates the Overall Points made by the contestant in all 3 rounds
and prints it out.
contestantRec[recNo].overallPts = contestantRec[recNo].totalPtsEarned1 +
contestantRec[recNo].totalPtsEarned2 + contestantRec[recNo].totalPtsEarned3;
// The following lines converts the contestant's points into cash.
contestantRec[recNo].cashEarned = (contestantRec[recNo].overallPts / 20) * 5;
// The following lines promts the user to state whether or not they would like to convert
cash in USD to TTD.
printf("Would you like to convert cash into TTD? Enter 'Y' for yes or 'N' for no: ");
scanf("%s",&response);
if (response == 'Y'){
contestantRec[recNo].cashEarnedTT = contestantRec[recnumber].cashEarned * 6.79660;
}else{
contestantRec[recNo].cashEarned;
}
recNo++;
system("pause");
system("cls");
}// _________________________________________________ end of add player
________________________________________________________
//###############################################################################################
################################
// start of view all
void viewALL () {
system("cls");
int x = 0;
printf("|----------------------------------------------------------------------------------
|n");
printf("| #####################/** RECORDS OF All CONTESTANTS!! **/#####################
|n");
printf("|----------------------------------------------------------------------------------
|nn");
for (x = 0; x < recNo; x++) {
30. 29
printf("*** --------------- _CONTESTANT'S RECORD_ --------------- ***n");
printf(" _________________________________________________________ n");
printf(" |-----**Registeration Information of Contestant!!**-----|n");
printf(" |** Contestant's ID: %d
n",contestantRec[x].contestantID);
printf(" |** Contestant's First Name: %s
n",contestantRec[x].contestantFName);
printf(" |** Contestant's Last Name: %s
n",contestantRec[x].contestantLName);
printf(" |** Contestant's Month of Participation: %s
nn",contestantRec[x].monthOfParticipation);
printf(" |-----**NUMBER OF CORRECT ANSWERS AT EACH ROUND!!**-----|n");
printf(" |** Round 1 Correct Anwers: %d
n",contestantRec[x].noCorrectAns1);
printf(" |** Round 2 Correct Anwers: %d
n",contestantRec[x].noCorrectAns2);
printf(" |** Round 3 Correct Anwers: %d
nn",contestantRec[x].noCorrectAns3);
printf(" |--------**TOTAL POINTS EARNED AT EACH ROUND!!**--------|n");
printf(" |** Round 1 Points: %d
n",contestantRec[x].totalPtsEarned1);
printf(" |** Round 2 Points: %d
n",contestantRec[x].totalPtsEarned2);
printf(" |** Round 3 Points: %d
nn",contestantRec[x].totalPtsEarned3);
printf(" |*******************************************************n");
printf(" |** Overall Points: %d n",contestantRec[x].overallPts);
printf(" |** Cash Earned In USD: $%d n",contestantRec[x].cashEarned);
printf(" |** Cash Earned In TTD: $%f n",contestantRec[x].cashEarnedTT);
printf(" |*******************************************************|nn");
printf(" |------**QUALIFICATION STATUS FOR NEXT SESSION!!**------|n");
if (contestantRec[x].overallPts >= 110) {
printf(" |** Status: QUALIFIEDn");
}else{
printf(" |** Status: UNQUALIFIED!n");
printf(" |** ATLEAST 120 points is required to advance! **n");
}
printf(" |########~~~~~~~#######________#########~~~~~~~~~#######|nnn");
}
system("pause");
system("cls");
}//_____________________________________________ End of Display All
__________________________________________________________
31. 30
//###############################################################################################
################################
// start of bubbleSort
void bubbleSort () {
system ("cls");
int i, j, flag = 1;
int temp_contestantID;
char temp_contestantFName[20], temp_contestantLName[20], temp_monthOfParticipation[3];
int temp_noCorrectAns1, temp_noCorrectAns2, temp_noCorrectAns3;
int temp_totalPtsEarned1, temp_totalPtsEarned2, temp_totalPtsEarned3, temp_overallPts;
int temp_cashEarned;
float temp_cashEarnedTT;
printf("================================/** SORTING RECORDS
**/===============================n");
printf("-------------------------------------------------------------------------------------
-n");
for (i = 1; (i <= recnumber) && flag; i++) {
flag = 0;
for (j = 0; (j < recnumber - 1); j++) {
//The following lines sorts the records in DECSENDING order.
if (contestantRec[j + 1].overallPts > contestantRec[j].overallPts) { //swap values
temp_contestantID = contestantRec[j].contestantID;
contestantRec[j].contestantID = contestantRec[j+1].contestantID;
contestantRec[j+1].contestantID = temp_contestantID;
strcpy(temp_contestantFName,contestantRec[j].contestantFName);
strcpy(contestantRec[j].contestantFName, contestantRec[j+1].contestantFName);
strcpy(contestantRec[j+1].contestantFName, temp_contestantFName);
strcpy(temp_contestantLName,contestantRec[j].contestantLName);
strcpy(contestantRec[j].contestantLName, contestantRec[j+1].contestantLName);
strcpy(contestantRec[j+1].contestantLName, temp_contestantLName);
strcpy(temp_monthOfParticipation,contestantRec[j].monthOfParticipation);
strcpy(contestantRec[j].monthOfParticipation,
contestantRec[j+1].monthOfParticipation);
strcpy(contestantRec[j+1].monthOfParticipation, temp_monthOfParticipation);
temp_noCorrectAns1 = contestantRec[j].noCorrectAns1;
contestantRec[j].noCorrectAns1 = contestantRec[j+1].noCorrectAns1;
contestantRec[j+1].noCorrectAns1 = temp_noCorrectAns1;
temp_noCorrectAns2 = contestantRec[j].noCorrectAns2;
contestantRec[j].noCorrectAns2 = contestantRec[j+1].noCorrectAns2;
contestantRec[j+1].noCorrectAns2 = temp_noCorrectAns2;
36. 35
//###############################################################################################
################################
// start of mainmenu
int main (void) {
char choice;
do{
Intro_Screen();
printf("nn--------------------------------n");
printf("| MAIN MENU |n");
printf("--------------------------------n");
printf("| 1. Add New Contestant |n");
printf("| 2. View All Records REPORT |n");
printf("| 3. Sort Records |n");
printf("| 4. Export ALL Records |n");
printf("| 5. Import Data from file |n");
printf("| 6. Exit |n");
printf("--------------------------------nn");
scanf("%s",&choice);
switch (choice){
case '1':
addContestant();
break;
case '2':
viewALL();
break;
case '3':
bubbleSort();
break;
case '4':
exportData();
break;
case '5':
importData();
break;
case '6':
//exit();
break;
default:
printf("INVALID CHOICEn");
break;
}
}while (choice != '6');
}// ____________________________________________________ end of mainmenu
________________________________________________________
37. 36
FILE DESIGN
Variable Name Data Types Length Description Sample
Data
contestantID int 4 Holds the ID of the
contestant
0401
contestantFName char 20 Holds the first name
of the contestant
James
contestantLName char 20 Holds the last name of
the contestant
Paul
monthOfParticipation char 3 Holds the month the
contestant participated
Apr
noCorrectAns1 int 4 Holds number of
questions answered
correctly in round 1
19
noCorrectAns2 int 4 Holds number of
questions answered
correctly in round 2
14
noCorrectAns3 int 4 Holds number of
questions answered
correctly in round 3
12
totalPtsEarned1 int 4 Holds the total points
contestant earned at
round 1
20
totalPtsEarned2 int 4 Holds the total points
contestant earned at
round 1
30
totalPtsEarned3 int 4 Holds the total points
contestant earned at
round 1
60
overallPts int 4 Holds the overall
points contestant has
110
cashEarned int 4 Holds the amount of
cash contestant earned
in USD
25
cashEarnedTT float 4 Holds the amount of
cash contestant earned
in TTD
169.91
38. 37
WHITEBOX TESTING
Variable Name Data
Type
Length Test Test Data Results
Expected Actual
contestantID int 4 Normal 0401 Accepted Accepted
Extreme 9999 Accepted Accepted
Abnormal 123 Rejected Rejected
contestantFName character
string
20 Normal James Accepted Accepted
Extreme abcdefghijklmnopqrst Accepted Accepted
Abnormal abcdefghijklmnopqrstu Rejected Rejected
contestantLName character
string
20 Normal Paul Accepted Accepted
Extreme abcdefghijklmnopqrst Accepted Accepted
Abnormal abcdefghijklmnopqrstu Rejected Rejected
monthOfParticipation character
string
3 Normal Apr Accepted Accepted
Extreme abc Accepted Accepted
Abnormal abcd Rejected Rejected
noCorrectAns1 int 4 Normal 19 Accepted Accepted
Extreme 20 Accepted Accepted
Abnormal 21 Rejected Rejected
noCorrectAns2 int 4 Normal 14 Accepted Accepted
Extreme 24 Accepted Accepted
Abnormal 25 Rejected Rejected
noCorrectAns3 int 4 Normal 12 Accepted Accepted
Extreme 16 Accepted Accepted
Abnormal 17 Rejected Rejected
totalPtsEarned1 int 4 Normal
Extreme
Abnormal
totalPtsEarned2 int 4 Normal
Extreme
Abnormal
totalPtsEarned3 int 4 Normal
Extreme
Abnormal
overallPts int 4 Normal
Extreme
Abnormal
cashEarned int 4 Normal
Extreme
Abnormal
cashEarnedTT float 4 Normal
Extreme
Abnormal
41. 40
FUNCTIONAL TESTING
Add Contestant
Test 1: Adds a contestant to log, with user-defined criteria.
Display All
Test 2: Displays the currently stored records in the program.
42. 41
Bubble Sort
Test 3: Sors the data in descending order via bubble sort.
Before:
After:
43. 42
ExportData
Test 4: Copies the currently stored data from the program to a file on the computer.
Before:
After:
44. 43
USER DOCUMENTATION
How to add a Contestant to the Log:
1. In the Main Menu, type the digit 1 and then enter.
2. Enter the contestant’s Contestant ID
3. Enter the contestant’s First Name
4. Enter the contestant’s Last Name
5. Enter the contestant’s Month of Participation
6. Enter the number of correct Round 1 answers
7. Enter the number of correct Round 2 answers
8. Enter the number of correct Round 3 answers
9. Enter if the cash earned by contestant is to be converted to TTD
10. Press any key to exit to the Main Menu
45. 44
How to display all Contestant Records:
1. In the Main Menu, type the digit 2 and then enter
2. Press any key to exit to the Main Menu
How to sort the records:
1. After the necessary records are entered and stored, in the Main Menu type the digit 3 and
then enter.
2. Press any key to exit to the Main Menu
3. From the Main Menu, type the digit 2 and then enter to view the sorted records.
46. 45
How to export the records:
1. In the Main Menu, type the digit 4 and then enter to export the records to an external file.
2. Check the file which contains the exported records for verification
3. Press any key to exit to the Main Menu
How to import the records:
1. In the Main Menu, type the digit 5 and then enter to import records to the program.