SlideShare a Scribd company logo
1 of 49
Download to read offline
COMPUTER SCIENCE I.A.
CANDIDATE NAME:
CANDIDATE NO.:
SCHOOL NAME: ST. MARY’S COLLEGE
CENTRE NO.: 160073
TEACHER: MR. RAMDHANIE
YEAR:
TABLE OF CONTENTS
PROBLEM DESCRIPTION.......................................................................................................................................................... 3
Functional Requirements.................................................................................................................................................... 5
............................................................................................................................................................................................ 5
Non-Functional Requirements............................................................................................................................................ 5
PSEUDOCODE.......................................................................................................................................................................... 6
TECHNICAL DOCUMENTATION ............................................................................................................................................. 22
HIPO Chart......................................................................................................................................................................... 22
Program Code ................................................................................................................................................................... 23
File Design......................................................................................................................................................................... 39
TESTING................................................................................................................................................................................. 40
Whitebox Testing with Results ......................................................................................................................................... 40
Functional Testing............................................................................................................................................................. 43
USER DOCUMENTATION....................................................................................................................................................... 48
PROBLEM DESCRIPTION
During the Christmas season, an annual dessert making competition is held by the ‘PriceSmart Inc.’ branches in
Trinidad and Tobago with the winner getting a free 18 months membership. The competition is open to anyone
eighteen years and older. The scoring for this competition is done manually.
A judge would go to all the contestants and try their desserts. A scoresheet would be provided for each contestant
and upon trying their dessert the judges would rate each section from 1(worst) to 10(great). Afterwards the total
would be calculated by dividing the sum of the sections.
Total = (Appearance score + Texture score + Taste score) ÷ 3
The number of competitors registered was excessive which made keeping score of all the contestants manually
difficult.
To resolve this problem, a program was developed to function as a database to keep track of all the contestants’
information. The program’s functionalities included insertion of contestant information, sorting of contestants'
data, exporting of contestants' data to external device and importing of contestant data from an external device.
Scorecard for competition
Filled-out scorecard
Functional Requirements
Adding a Contestant: The system should allow the input of a contestant with all relevant information. This
includes their name and their dessert’s score for each section.
Calculating Total Score: The system should be able to automatically calculate the total.
Display All: The system should be able to show a list of all the contestants with their respective information and
total.
Sort: The system should be able to automatically sort the list by contestant total in ascending and descending
order. This would help determine the winner.
Non-Functional Requirements
User Friendly Interface: The system should be easy to maneuver and inviting to most to all users
Data Validation: There must be a way to distinguish that all the data entered pertains to its section. This would
help prevent errors in contestant records.
New Sort: The system should have a more efficient sorting program.
PSEUDOCODE
Narrative Description:
This procedure shows a welcome art to start the program.
FUNCTION welcome()
BEGIN
OUTPUT " _ _ _______ ___ _______ _______ __ __ _______ "
OUTPUT " | | _ | || || | | || || |_| || | "
OUTPUT " | || || || ___|| | | _|| _ || || ___| "
OUTPUT " | || |___ | | | | | | | || || |___ "
OUTPUT " | || ___|| |___ | | | |_| || || ___| "
OUTPUT " | _ || |___ | || |_ | || ||_|| || |___ "
OUTPUT " |__| |__||_______||_______||_______||_______||_| |_||_______| "
OUTPUT " +- "
OUTPUT " .*- "
OUTPUT " *: "
OUTPUT " .#. "
OUTPUT " -* "
OUTPUT " *: "
OUTPUT " == "
OUTPUT " :+ "
OUTPUT " :* "
OUTPUT " .::::.-= "
OUTPUT " =***++**#####*+=. "
OUTPUT " :****: +********#: "
OUTPUT " #*****+=+**********# "
OUTPUT " #***************++*# "
OUTPUT " #************+===** "
OUTPUT " #****++++++===+*# "
OUTPUT " ##**+++++++**+= "
END welcome
STRUCT foodcomp
char comp_fname[15]
char comp_lname[15]
float appearance_score
float texture_score
float taste_score
float total_score
int comp_no
DECLARE foodcomp foodcomp_rec[15]
DECLARE int recnumber=0
Narrative Description:
This procedure allows for the adding of a contestant’s information.
FUNCTION add_competitor()
BEGIN
DECLARE char check
DECLARE char check2
DECLARE char multi_temp[15]
DECLARE int marker
DECLARE int x
DECLARE int appearance_box
DECLARE int texture_box
DECLARE int taste_box
system "cls"
OUTPUT "????????????????????????? Add NEW COMPETITOR :) ?????????????????????????"
check = 'F'
check2 = 'F'
DO
OUTPUT "Please enter first name"
INPUT multi_temp
IF(strlen(multi_temp)>15) THEN
check2 ='F'
OUTPUT "COMPETITOR LAST NAME HAS EXCEEDED SYSTEM LIMIT!"
ELSE
check2 = 'T'
END IF
marker = 0
FOR (x = 0; x<strlen(multi_temp); x++)
IF (isdigit(multi_temp[x])>0) THEN
marker = 1
END IF
END FOR
IF (marker == 0) THEN
check ='T'
ELSE
OUTPUT "INVALID VALUE ENTERED!"
END IF
WHILE (check =='F'OR check2 =='F')
strcpy(foodcomp_rec[recnumber].comp_fname, multi_temp)
check = 'F'
check2 = 'F'
DO
OUTPUT "Please enter last name"
INPUT multi_temp
IF(strlen(multi_temp)>15) THEN
check2 ='F'
OUTPUT"COMPETITOR LAST NAME HAS EXCEEDED SYSTEM LIMIT!"
ELSE
check2 = 'T'
END IF
marker = 0;
FOR (x = 0; x<strlen(multi_temp); x++)
IF (isdigit(multi_temp[x])>0) THEN
marker = 1
END IF
END FOR
IF (marker == 0) THEN
check ='T'
ELSE
OUTPUT "INVALID VALUE ENTERED!"
END IF
WHILE (check =='F'OR check2 =='F')
strcpy(foodcomp_rec[recnumber].comp_lname, multi_temp)
check = 'F'
DO
OUTPUT "Please enter score for meal appearance(1 to 10)"
INPUT multi_temp
marker = 0
FOR (x = 0; x<strlen(multi_temp); x++)
IF(isdigit(multi_temp[x])==0) THEN
marker = 1
END IF
END FOR
IF (marker == 1) THEN
check='F'
OUTPUT"INVALID VALUE ENTERED!"
ELSE
appearance_box = atoi(multi_temp)
IF (appearance_box< 1 OR appearance_box> 10) THEN
check ='F'
OUTPUT "THE VALUE ENTERED HAS EXCEEDED SYSTEM LIMIT!"
ELSE
check ='T'
END IF
END IF
WHILE (check=='F')
foodcomp_rec[recnumber].appearance_score = appearance_box
check = 'F'
DO
OUTPUT "Please enter score for meal texture(1 to 10)"
INPUT multi_temp
marker = 0
FOR (x = 0; x<strlen(multi_temp); x++)
IF(isdigit(multi_temp[x])==0) THEN
marker = 1
END IF
END FOR
IF (marker == 1) THEN
check='F'
OUTPUT"INVALID VALUE ENTERED!"
ELSE
texture_box = atoi(multi_temp)
IF (texture_box< 1 OR texture_box> 10) THEN
check ='F'
OUTPUT "THE VALUE ENTERED HAS EXCEEDED SYSTEM LIMIT!"
ELSE
check ='T'
END IF
END IF
WHILE (check=='F')
foodcomp_rec[recnumber].texture_score = texture_box
check = 'F'
DO
OUTPUT "Please enter score for meal taste(1 to 10)"
INPUT multi_temp
marker = 0
FOR (x = 0; x<strlen(multi_temp); x++)
IF(isdigit(multi_temp[x])==0) THEN
marker = 1
END IF
END FOR
IF (marker == 1) THEN
check='F'
OUTPUT"INVALID VALUE ENTERED!"
ELSE
taste_box = atoi(multi_temp)
IF (taste_box< 1 OR taste_box> 10) THEN
check ='F'
OUTPUT "THE VALUE ENTERED HAS EXCEEDED SYSTEM LIMIT!"
ELSE
check ='T'
END IF
END IF
WHILE (check=='F')
foodcomp_rec[recnumber].taste_score = taste_box
foodcomp_rec[recnumber].total_score = (foodcomp_rec[recnumber].appearance_score +
foodcomp_rec[recnumber].texture_score + foodcomp_rec[recnumber].taste_score)/3
OUTPUT "Total Score = ", foodcomp_rec[recnumber].total_score
recnumber = recnumber + 1
END add_competitor
Narrative Description:
This procedure allows the user to display all the information for the contestants on record.
FUNCTION allcompetitors()
BEGIN
DECLARE int i;
foodcomp_rec[recnumber].comp_no = 0;
system "cls"
OUTPUT "????????????????????????? RECORDS (._.)?????????????????????????"
FOR (i=0;i<recnumber;i++){
foodcomp_rec[recnumber].comp_no++;
OUTPUT "Competitor No.",foodcomp_rec[recnumber].comp_no
OUTPUT "First Name: ",foodcomp_rec[i].comp_fname
OUTPUT "Last Name: ",foodcomp_rec[i].comp_lname
OUTPUT "Appearance Score = ",foodcomp_rec[i].appearance_score
OUTPUT "Texture Score = ",foodcomp_rec[i].texture_score
OUTPUT "Taste Score = ",foodcomp_rec[i].taste_score
OUTPUT "Total Score = ",foodcomp_rec[i].total_score
OUTPUT "----------------------"
END FOR
system "pause"
END allcompetitors
Narrative Description:
This procedure allows the user to sort the data entered by ascending or descending order using a bubble
sort.
FUNCTION sort_competitors()
BEGIN
DECLARE int a
DECLARE int b
DECLARE int x
DECLARE int checkmrk
DECLARE int marker = 1
DECLARE char fnme_box[15]
DECLARE char lnme_box[15]
DECLARE char check
DECLARE char check2
DECLARE char multi_temp[15]
DECLARE int sort_type
DECLARE float total_box
DECLARE float appearance_boX
DECLARE float taste_box
DECLARE float texture_box
system "cls"
OUTPUT "????????????????????????? SORT ('o')?????????????????????????"
check ='F'
DO
OUTPUT "Choose Sort Type:(1)Ascending (2)Descending"
INPUT multi_temp
marker = 0;
FOR (x = 0; x<strlen(multi_temp); x++)
IF(isdigit(multi_temp[x])==0) THEN
marker = 1
END IF
END FOR
IF (marker == 1) THEN
check ='F'
OUTPUT "INVALID VALUE!"
ELSE
sort_type = atoi(multi_temp)
IF(sort_type==1 OR sort_type==2)THEN
check ='T'
ELSE
check ='F'
OUTPUT "INVALID ENTRY!"
END IF
END IF
WHILE (check=='F')
FOR(a=1;(a <= recnumber)&& checkmrk; a++)
checkmrk = 0;
FOR (b=0; b < (recnumber -1); b++)
IF(sort_type== 1) THEN
IF (foodcomp_rec[b+1].total_score < foodcomp_rec[b].total_score) THEN
strcpy(fnme_box,foodcomp_rec[b].comp_fname)
strcpy(foodcomp_rec[b].comp_fname, foodcomp_rec[b+1].comp_fname)
strcpy(foodcomp_rec[b+1].comp_fname, fnme_box)
strcpy(lnme_box,foodcomp_rec[b].comp_lname)
strcpy(foodcomp_rec[b].comp_lname, foodcomp_rec[b+1].comp_lname)
strcpy(foodcomp_rec[b+1].comp_lname, lnme_box)
total_box = foodcomp_rec[b].total_score
foodcomp_rec[b].total_score = foodcomp_rec[b+1].total_score
foodcomp_rec[b+1].total_score = total_box
appearance_box= foodcomp_rec[b].appearance_score
foodcomp_rec[b].appearance_score = foodcomp_rec[b+1].appearance_score
foodcomp_rec[b+1].appearance_score = appearance_box
taste_box = foodcomp_rec[b].taste_score
foodcomp_rec[b].taste_score = foodcomp_rec[b+1].taste_score
foodcomp_rec[b+1].taste_score = taste_box
texture_box = foodcomp_rec[b].texture_score
foodcomp_rec[b].texture_score = foodcomp_rec[b+1].texture_score
foodcomp_rec[b+1].texture_score = texture_box
checkmrk = 1
END IF
ELSE IF (sort_type== 2) THEN
IF (foodcomp_rec[b+1].total_score > foodcomp_rec[b].total_score) THEN
strcpy(fnme_box,foodcomp_rec[b].comp_fname)
strcpy(foodcomp_rec[b].comp_fname, foodcomp_rec[b+1].comp_fname)
strcpy(foodcomp_rec[b+1].comp_fname, fnme_box)
strcpy(lnme_box,foodcomp_rec[b].comp_lname)
strcpy(foodcomp_rec[b].comp_lname, foodcomp_rec[b+1].comp_lname)
strcpy(foodcomp_rec[b+1].comp_lname, lnme_box)
total_box = foodcomp_rec[b].total_score
foodcomp_rec[b].total_score = foodcomp_rec[b+1].total_score
foodcomp_rec[b+1].total_score = total_box
appearance_box= foodcomp_rec[b].appearance_score
foodcomp_rec[b].appearance_score = foodcomp_rec[b+1].appearance_score
foodcomp_rec[b+1].appearance_score = appearance_box
taste_box = foodcomp_rec[b].taste_score
foodcomp_rec[b].taste_score = foodcomp_rec[b+1].taste_score
foodcomp_rec[b+1].taste_score = taste_box
texture_box = foodcomp_rec[b].texture_score
foodcomp_rec[b].texture_score = foodcomp_rec[b+1].texture_score
foodcomp_rec[b+1].texture_score = texture_box
checkmrk = 1
END IF
END IF
END FOR
END FOR
OUTPUT "Record of Competitors Sorted"
system"pause"
END sort_competitors
Narrative Description:
This procedure allows the user to export all the records onto a separate text file
FUNCTION record_export()
BEGIN
DECLARE int x
FILE * exportfile
exportfile = fopen("FoodExport.txt","w+")
fprintf(exportfile, "%dn", recnumber)
FOR(x=0;x<recnumber;x++)
OUTPUT exportfile, " ", foodcomp_rec[x].comp_fname)
OUTPUT exportfile, " ", foodcomp_rec[x].comp_lname)
OUTPUT exportfile, " ", foodcomp_rec[x].appearance_score)
OUTPUT exportfile, " ", foodcomp_rec[x].texture_score)
OUTPUT exportfile, " ", foodcomp_rec[x].taste_score)
OUTPUT exportfile, " ", foodcomp_rec[x].total_score)
END FOR
fclose(exportfile)
OUTPUT "File Data Exported"
system "pause"
END record_export
Narrative Description:
This procedure allows the user to import contestant records from a text file
FUNCTION record_import()
BEGIN
DECLARE int y
system"cls"
OUTPUT "????????????????????????? IMPORTED RECORDS (.-.)?????????????????????????"
FILE * importfile;
importfile = fopen("FoodExport.txt","r")
fscanf(importfile, " ",recnumber )
foodcomp_rec[recnumber].comp_no = 0
FOR(y=0;y<recnumber;y++)
fscanf(importfile, " ", foodcomp_rec[y].comp_fname)
fscanf(importfile, " ", foodcomp_rec[y].comp_lname)
fscanf(importfile, " ", &foodcomp_rec[y].appearance_score)
fscanf(importfile, " ", &foodcomp_rec[y].texture_score)
fscanf(importfile, " ", &foodcomp_rec[y].taste_score)
fscanf(importfile, " ", &foodcomp_rec[y].total_score)
foodcomp_rec[recnumber].comp_no = foodcomp_rec[recnumber].comp_no + 1
OUTPUT "Competitor No. ",foodcomp_rec[recnumber].comp_no
OUTPUT "First Name: ",foodcomp_rec[y].comp_fname
OUTPUT "Last Name: ",foodcomp_rec[y].comp_lname
OUTPUT "Appearance Score = ",foodcomp_rec[y].appearance_score
OUTPUT "Texture Score = ",foodcomp_rec[y].texture_score
OUTPUT "Taste Score = ",foodcomp_rec[y].taste_score
OUTPUT "Total Score = ",foodcomp_rec[y].total_score
OUTPUT "----------------------"
END FOR
fclose(importfile);
OUTPUT "File Data Imported"
system"pause"
END record_import
Narrative Description:
This procedure allows the user to maneuver to the different procedures as it is the main menu
main()
BEGIN
DECLARE char section
welcome()
system"pause"
DO
system"cls"
OUTPUT " --------------------------- "
OUTPUT " | MAIN MENU | "
OUTPUT " --------------------------- "
OUTPUT " |1. Add New Competitor | "
OUTPUT " |2. Record of All Entries | "
OUTPUT " |3. Sort Records | "
OUTPUT " |4. Export All Records | "
OUTPUT " |5. Import Data From File | "
OUTPUT " |6. Exit | "
OUTPUT " --------------------------- "
OUTPUT " Please select an option: "
INPUT section
switch (section)
case '1':
add_competitor()
break
case '2':
allcompetitors()
break
case '3':
sort_competitors()
break
case '4':
record_export()
break
case '5':
record_import()
break;
case '6':
record_export()
break
default:
OUTPUT "INVALID CHOICE!"
system "pause"
break;
END switch
WHILE (section <>'6')
END main
TECHNICAL DOCUMENTATION
HIPO Chart
Program Code
#include <stdio.h>
#include <iostream>
#include <windows.h>
using namespace std;
void welcome(void){//module welcome displays start art
printf(" _ _ _______ ___ _______ _______ __ __ _______n");
printf(" | | _ | || || | | || || |_| || |n");
printf(" | || || || ___|| | | _|| _ || || ___|n");
printf(" | || |___ | | | | | | | || || |___ n");
printf(" | || ___|| |___ | | | |_| || || ___|n");
printf(" | _ || |___ | || |_ | || ||_|| || |___ n");
printf(" |__| |__||_______||_______||_______||_______||_| |_||_______|n");
printf(" +-n");
printf(" .*-n");
printf(" *:n");
printf(" .#.n");
printf(" -*n");
printf(" *:n");
printf(" ==n");
printf(" :+n");
printf(" :*n");
printf(" .::::.-=n");
printf(" =***++**#####*+=.n");
printf(" :****: +********#:n");
printf(" #*****+=+**********#n");
printf(" #***************++*#n");
printf(" #************+===**n");
printf(" #****++++++===+*#n");
printf(" ##**+++++++**+=n");
}//end of welcome
//????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????????
typedef struct {//structure to store variables
char comp_fname[15];//first name limit
char comp_lname[15];//last name limit
float appearance_score, texture_score, taste_score;
float total_score;
int comp_no;//competitor number
} foodcomp;
foodcomp foodcomp_rec[15];
int recnumber=0;
//????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????????
void add_competitor (){//this module allows for contestants to be added
char check, check2, multi_temp[15];
int marker, x, appearance_box, texture_box, taste_box;
system ("cls");
printf("????????????????????????? Add NEW COMPETITOR :) ?????????????????????????n");//addplayer
banner
check = 'F';
check2 = 'F';//set first name Validation
do{
printf("Please enter first namen");
scanf("%s",multi_temp);//save value in temporary variable
if(strlen(multi_temp)>15){
check2 ='F';
printf("COMPETITOR FIRST NAME HAS EXCEEDED SYSTEM LIMIT!n");//validation prompt for
character limit
}else{
check2 = 'T';
}
marker = 0;
for(x = 0; x<strlen(multi_temp); x++){
if(isdigit(multi_temp[x])>0){
marker = 1;
}
}
if (marker == 0){
check ='T';
}else{
printf("INVALID VALUE ENTERED!n");//validation prompt for data type check
}
}while (check =='F'|| check2 =='F');
strcpy(foodcomp_rec[recnumber].comp_fname, multi_temp);//End of Validation (firstname) for field type
and field size
check = 'F';
check2 = 'F';//Reset checks for last name Validation
do{
printf("Please enter last namen");
scanf("%s",multi_temp);//save value in temporary variable
if(strlen(multi_temp)>15){
check2 ='F';
printf("COMPETITOR LAST NAME HAS EXCEEDED SYSTEM LIMIT!n");//validation prompt for
character limit
}else{
check2 = 'T';
}
marker = 0;
for(x = 0; x<strlen(multi_temp); x++){
if(isdigit(multi_temp[x])>0){
marker = 1;
}
}
if (marker == 0){
check ='T';
}else{
printf("INVALID VALUE ENTERED!n");
}
}while (check =='F'|| check2 =='F');
strcpy(foodcomp_rec[recnumber].comp_lname, multi_temp);//End of Validation (lastname) for field type and
field size
check = 'F';//Reset checks for appearance validation
do{
printf("Please enter score for meal appearance(1 to 10)n");
scanf("%s",&multi_temp);
marker = 0;
for(x = 0; x<strlen(multi_temp); x++){
if(isdigit(multi_temp[x])==0){
marker = 1;
}
}
if (marker == 1){
check='F';
printf("INVALID VALUE ENTERED!n");
}else{
appearance_box = atoi(multi_temp);//change field type for number limit check
if(appearance_box< 1 || appearance_box> 10){
check ='F';
printf("THE VALUE ENTERED HAS EXCEEDED SYSTEM LIMIT!n");
}else{
check ='T';
}
}
}while(check=='F');
foodcomp_rec[recnumber].appearance_score = appearance_box;//Validation for appearance field type and
limit
check = 'F';//Reset checks for texture validation
do{
printf("Please enter score for meal texture(1 to 10)n");
scanf("%s",&multi_temp);
marker = 0;
for(x = 0; x<strlen(multi_temp); x++){
if(isdigit(multi_temp[x])==0){
marker = 1;
}
}
if (marker == 1){
check='F';
printf("INVALID VALUE ENTERED!n");
}else{
texture_box = atoi(multi_temp);//change field type for number limit check
if(texture_box< 1 || texture_box> 10){
check ='F';
printf("THE VALUE ENTERED HAS EXCEEDED SYSTEM LIMIT!n");
}else{
check ='T';
}
}
}while(check=='F');
foodcomp_rec[recnumber].texture_score = texture_box;//Validation for texture field type and limit
check = 'F';//Reset checks for taste validation
do{
printf("Please enter score for meal taste(1 to 10)n");
scanf("%s",&multi_temp);
marker = 0;
for(x = 0; x<strlen(multi_temp); x++){
if(isdigit(multi_temp[x])==0){
marker = 1;
}
}
if (marker == 1){
check ='F';
printf("INVALID VALUE ENTERED!n");
}else{
taste_box = atoi(multi_temp);//change field type for number limit check
if(taste_box< 1 || taste_box> 10){
check ='F';
printf("THE VALUE ENTERED HAS EXCEEDED SYSTEM LIMIT!n");
}else{
check ='T';
}
}
}while(check=='F');
foodcomp_rec[recnumber].taste_score = taste_box;//Validation for taste field type and limit
foodcomp_rec[recnumber].total_score = (foodcomp_rec[recnumber].appearance_score +
foodcomp_rec[recnumber].texture_score + foodcomp_rec[recnumber].taste_score)/3;//total calculations
printf("Total Score = %2.1f", foodcomp_rec[recnumber].total_score);
recnumber++;
getchar();
getchar();
}//end of add_player
//????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????????
void allcompetitors(){//this module displays all contestants
int i;
foodcomp_rec[recnumber].comp_no = 0;
system("cls");
printf("????????????????????????? RECORDS (._.)?????????????????????????n");//display all banner
for(i=0;i<recnumber;i++){
foodcomp_rec[recnumber].comp_no++;
printf("Competitor No.%dn",foodcomp_rec[recnumber].comp_no);
printf("First Name: %sn",foodcomp_rec[i].comp_fname);
printf("Last Name: %sn",foodcomp_rec[i].comp_lname);
printf("Appearance Score = %2.1fn",foodcomp_rec[i].appearance_score);
printf("Texture Score = %2.1fn",foodcomp_rec[i].texture_score);
printf("Taste Score = %2.1fn",foodcomp_rec[i].taste_score);
printf("Total Score = %2.1fn",foodcomp_rec[i].total_score);
printf("----------------------n");//record separater
}
system("pause");
}//end of display all
//????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????????
void sort_competitors(){//This module uses a bubble sort to sort the records in display all
int a, b,x, checkmrk, marker = 1;
char fnme_box[15];
char lnme_box[15], check, check2, multi_temp[15];
int sort_type;
float total_box, appearance_box, taste_box, texture_box;
system("cls");
printf("????????????????????????? SORT ('o')?????????????????????????n");//sort banner
check ='F';
do{
printf("Choose Sort Type:(1)Ascending (2)Descendingn");
scanf("%s",&multi_temp);
marker = 0;
for(x = 0; x<strlen(multi_temp); x++){
if(isdigit(multi_temp[x])==0){
marker = 1;
}
}//For
if (marker == 1){
check ='F';
printf("INVALID VALUE!n");//validation prompt
}else{
sort_type = atoi(multi_temp);//change field type for number limit check
if(sort_type==1||sort_type==2){
check ='T';
}else{
check ='F';
printf("INVALID ENTRY!n");
}
}
}while(check=='F');
for(a=1;(a <= recnumber)&& checkmrk; a++){
checkmrk = 0;
for(b=0; b < (recnumber -1); b++){
if(sort_type== 1){
if (foodcomp_rec[b+1].total_score < foodcomp_rec[b].total_score){//ascending order
strcpy(fnme_box,foodcomp_rec[b].comp_fname);
strcpy(foodcomp_rec[b].comp_fname, foodcomp_rec[b+1].comp_fname);
strcpy(foodcomp_rec[b+1].comp_fname, fnme_box);
strcpy(lnme_box,foodcomp_rec[b].comp_lname);
strcpy(foodcomp_rec[b].comp_lname, foodcomp_rec[b+1].comp_lname);
strcpy(foodcomp_rec[b+1].comp_lname, lnme_box);
total_box = foodcomp_rec[b].total_score;
foodcomp_rec[b].total_score = foodcomp_rec[b+1].total_score;
foodcomp_rec[b+1].total_score = total_box;
appearance_box= foodcomp_rec[b].appearance_score;
foodcomp_rec[b].appearance_score = foodcomp_rec[b+1].appearance_score;
foodcomp_rec[b+1].appearance_score = appearance_box;
taste_box = foodcomp_rec[b].taste_score;
foodcomp_rec[b].taste_score = foodcomp_rec[b+1].taste_score;
foodcomp_rec[b+1].taste_score = taste_box;
texture_box = foodcomp_rec[b].texture_score;
foodcomp_rec[b].texture_score = foodcomp_rec[b+1].texture_score;
foodcomp_rec[b+1].texture_score = texture_box;
checkmrk = 1;
}//end if
} else if(sort_type== 2){
if (foodcomp_rec[b+1].total_score > foodcomp_rec[b].total_score){//descending order
strcpy(fnme_box,foodcomp_rec[b].comp_fname);
strcpy(foodcomp_rec[b].comp_fname, foodcomp_rec[b+1].comp_fname);
strcpy(foodcomp_rec[b+1].comp_fname, fnme_box);
strcpy(lnme_box,foodcomp_rec[b].comp_lname);
strcpy(foodcomp_rec[b].comp_lname, foodcomp_rec[b+1].comp_lname);
strcpy(foodcomp_rec[b+1].comp_lname, lnme_box);
total_box = foodcomp_rec[b].total_score;
foodcomp_rec[b].total_score = foodcomp_rec[b+1].total_score;
foodcomp_rec[b+1].total_score = total_box;
appearance_box= foodcomp_rec[b].appearance_score;
foodcomp_rec[b].appearance_score = foodcomp_rec[b+1].appearance_score;
foodcomp_rec[b+1].appearance_score = appearance_box;
taste_box = foodcomp_rec[b].taste_score;
foodcomp_rec[b].taste_score = foodcomp_rec[b+1].taste_score;
foodcomp_rec[b+1].taste_score = taste_box;
texture_box = foodcomp_rec[b].texture_score;
foodcomp_rec[b].texture_score = foodcomp_rec[b+1].texture_score;
foodcomp_rec[b+1].texture_score = texture_box;
checkmrk = 1;
}//end if
}
}//END FOR2
}//END FOR1
printf("nRecord of Competitors Sortedn");
system("pause");
return;
}//end of bubbleSort
//????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????????
void record_export(){//This module exports all the records to an external file
int x;
FILE * exportfile;
exportfile = fopen("FoodExport.txt","w+");//file given a name
fprintf(exportfile, "%dn", recnumber);
for(x=0;x<recnumber;x++){
fprintf(exportfile, "%sn", foodcomp_rec[x].comp_fname);
fprintf(exportfile, "%sn", foodcomp_rec[x].comp_lname);
fprintf(exportfile, "%2.1fn", foodcomp_rec[x].appearance_score);
fprintf(exportfile, "%2.1fn", foodcomp_rec[x].texture_score);
fprintf(exportfile, "%2.1fn", foodcomp_rec[x].taste_score);
fprintf(exportfile, "%2.1fn", foodcomp_rec[x].total_score);
}
fclose(exportfile);
printf("File Data Exportedn");//tells user that all the data has been exported
system("pause");
}//end of export
//????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????????
void record_import(){//This module imports data from the external file
int y;
system("cls");//cear screen
printf("????????????????????????? IMPORTED RECORDS (.-.)?????????????????????????n");//import
banner
FILE * importfile;
importfile = fopen("FoodExport.txt","r");//
fscanf(importfile, "%dn",&recnumber );
foodcomp_rec[recnumber].comp_no = 0;
for(y=0;y<recnumber;y++){
fscanf(importfile, "%sn", foodcomp_rec[y].comp_fname);
fscanf(importfile, "%sn", foodcomp_rec[y].comp_lname);
fscanf(importfile, "%dn", &foodcomp_rec[y].appearance_score);
fscanf(importfile, "%dn", &foodcomp_rec[y].texture_score);
fscanf(importfile, "%dn", &foodcomp_rec[y].taste_score);
fscanf(importfile, "%2.1fn", &foodcomp_rec[y].total_score);
foodcomp_rec[recnumber].comp_no++;
printf("Competitor No.%dn",foodcomp_rec[recnumber].comp_no);
printf("First Name: %sn",foodcomp_rec[y].comp_fname);
printf("Last Name: %sn",foodcomp_rec[y].comp_lname);
printf("Appearance Score = %dn",foodcomp_rec[y].appearance_score);
printf("Texture Score = %dn",foodcomp_rec[y].texture_score);
printf("Taste Score = %dn",foodcomp_rec[y].taste_score);
printf("Total Score = %2.1fn",foodcomp_rec[y].total_score);
printf("----------------------n");
}
fclose(importfile);
printf("File Data Imported");//tells user that all the data has been imported
system("pause");//press any key to continue
}//end of import
//????????????????????????????????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????????
int main() {//This is the main menu
char section;
welcome();//module welcome
system("pause");
do {
system("cls"); //clears the screen
printf(" ---------------------------n");
printf(" | MAIN MENU |n");
printf(" ---------------------------n");
printf(" |1. Add New Competitor |n");
printf(" |2. Record of All Entries |n");
printf(" |3. Sort Records |n");
printf(" |4. Export All Records |n");
printf(" |5. Import Data From File |n");
printf(" |6. Exit |n");
printf(" ---------------------------n");
printf(" Please select an option:n");
scanf ("%s",&section);
switch (section){
case '1':
add_competitor();
break;
case '2':
allcompetitors();
break;
case '3':
sort_competitors();
break;
case '4':
record_export();
break;
case '5':
record_import();
break;
case '6':
record_export();//This exports the records before closing the program
break;
default:
printf("INVALID CHOICE!n");
system("pause");
break;
}//end switch
} while (section != '6');
}//end of mainmenu
File Design
Variable Name Data Type Length Description Sample Data
comp_fname char 15 Holds the first
name of the
contestant
Moon
comp_lname char 15 Holds the last name
of the
contestant
Ley
appearance_score float 4 Holds the
appearance score of
the
contestant's dessert
7
texture_score float 4 Holds the texture
score of the
contestant's dessert
6
taste_score float 4 Holds the taste
score of the
contestant's dessert
8
total_score float 4 Holds the total
score the contestant
made
7
comp_no int 4 Holds the
contestant entry
number
1
TESTING
Whitebox Testing with Results
Variable Name
Data
Type
Length Test Test Data
Results
Expected Actual
comp_fname char 15
Normal Moon Accepted Accepted
Extreme abcdefghijklmno Accepted Accepted
Abnormal abcdefghijklmnop Rejected Rejected
comp_lname char 15
Normal Ley Accepted Accepted
Extreme abcdefghijklmno Accepted Accepted
Abnormal abcdefghijklmnop Rejected Rejected
appearance_score float 4
Normal 7 Accepted Accepted
Extreme 10 Accepted Accepted
Abnormal 11 Rejected Rejected
texture_score float 4
Normal 6 Accepted Accepted
Extreme 10 Accepted Accepted
Abnormal 11 Rejected Rejected
taste_score float 4
Normal 8 Accepted Accepted
Extreme 10 Accepted Accepted
Abnormal 11 Rejected Rejected
total_score float 4 Calculated Field
comp_no int 4 Calculated Field
Normal Data Test
Extreme Data Test
Abnormal Data Test
Functional Testing
Add_player
Test 1. User creates a contestant record using their information
Display_All
Test 2. Displays all contestant records inputted
Sort
Test 3. Uses bubble sort to sort the record in ascending or descending order
Ascending
Descending
Export
Test 4. The user can copy the records to an external file
Before
After
USER DOCUMENTATION
How to Navigate the Main Menu?
To select any of the options in the main menu type in the number (1, 2, 3...) relevant then press ‘Enter’
To Add a Record.
To add a record for a contestant, select ‘1’ in the main menu then press ‘Enter’. The screen would change and
you should see a banner at the top saying ‘Add a New Competitor’. Finally, follow the prompts and fill out the
necessary information.
To Display all Records
To display all current records, select ‘2’ in the main menu the press ‘Enter’. The screen would change and you
should see a banner at the top saying ‘Records’. There you should see all current records.
If there are no records the screen would just show the banner only.
To Sort all Records
To sort all records, select ‘3’ in the main menu the press ‘Enter’. The screen would change and you should see a
banner at the top saying ‘Sort’. There you should follow the prompts and choose a sort option. After selecting
your choice, a verification would appear in the next line. To check your sorted records, check the ‘Display All’
option in the main menu.
CAPE Unit1 Computer Science IA Sample .pdf

More Related Content

What's hot

my cape management of business 2012
my cape management of business 2012my cape management of business 2012
my cape management of business 2012
Anu Maharaj
 

What's hot (20)

CAPE Communication Studies IA
CAPE Communication Studies IACAPE Communication Studies IA
CAPE Communication Studies IA
 
CAPE Sociology Unit 1 IA
CAPE Sociology Unit 1 IACAPE Sociology Unit 1 IA
CAPE Sociology Unit 1 IA
 
Caribbean Studies - CAPE Unit 2 - Internal Assignment/IA 2017
Caribbean Studies - CAPE Unit 2 - Internal Assignment/IA 2017Caribbean Studies - CAPE Unit 2 - Internal Assignment/IA 2017
Caribbean Studies - CAPE Unit 2 - Internal Assignment/IA 2017
 
Communication Studies IA Sample
Communication Studies IA Sample Communication Studies IA Sample
Communication Studies IA Sample
 
Law Unit 1 Internal Assessment
Law Unit 1 Internal Assessment Law Unit 1 Internal Assessment
Law Unit 1 Internal Assessment
 
Review of Section A of CAPE Communication Studies Essay Paper
Review of Section A of CAPE Communication Studies Essay PaperReview of Section A of CAPE Communication Studies Essay Paper
Review of Section A of CAPE Communication Studies Essay Paper
 
CAPE Management Of Business Unit 1 IA
CAPE Management Of Business Unit 1 IACAPE Management Of Business Unit 1 IA
CAPE Management Of Business Unit 1 IA
 
CAPE Entrepreneurship Unit 1 SBA
CAPE Entrepreneurship Unit 1 SBACAPE Entrepreneurship Unit 1 SBA
CAPE Entrepreneurship Unit 1 SBA
 
Caribbean studies internal assessment
Caribbean studies internal assessmentCaribbean studies internal assessment
Caribbean studies internal assessment
 
Sociology IA
Sociology IASociology IA
Sociology IA
 
CAPE Communication Studies IA Guidelines
CAPE Communication Studies IA  GuidelinesCAPE Communication Studies IA  Guidelines
CAPE Communication Studies IA Guidelines
 
Cape Economics SBA
Cape Economics SBACape Economics SBA
Cape Economics SBA
 
my cape management of business 2012
my cape management of business 2012my cape management of business 2012
my cape management of business 2012
 
CAPE Communication Studies SBA
CAPE Communication Studies SBACAPE Communication Studies SBA
CAPE Communication Studies SBA
 
CXC CAPE Communication Studies-Language techniques
CXC CAPE Communication Studies-Language techniquesCXC CAPE Communication Studies-Language techniques
CXC CAPE Communication Studies-Language techniques
 
CAPE Accounting Internal Assessment SAMPLE
CAPE Accounting Internal Assessment SAMPLECAPE Accounting Internal Assessment SAMPLE
CAPE Accounting Internal Assessment SAMPLE
 
Caribbean studies IA Dejon Harris
Caribbean studies IA Dejon HarrisCaribbean studies IA Dejon Harris
Caribbean studies IA Dejon Harris
 
Mob sba guidelines
Mob sba guidelinesMob sba guidelines
Mob sba guidelines
 
CAPE Caribbean Studies SBA
CAPE Caribbean Studies SBACAPE Caribbean Studies SBA
CAPE Caribbean Studies SBA
 
Management if Business IA (MOB)
Management if Business IA (MOB)Management if Business IA (MOB)
Management if Business IA (MOB)
 

Similar to CAPE Unit1 Computer Science IA Sample .pdf

T sql denali code Day of .Net
T sql denali code Day of .NetT sql denali code Day of .Net
T sql denali code Day of .Net
KathiK58
 
You will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdfYou will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdf
FashionColZone
 
I keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdfI keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdf
herminaherman
 
#include iostream#includectimeusing namespace std;void.docx
#include iostream#includectimeusing namespace std;void.docx#include iostream#includectimeusing namespace std;void.docx
#include iostream#includectimeusing namespace std;void.docx
mayank272369
 

Similar to CAPE Unit1 Computer Science IA Sample .pdf (20)

Python Project On Cosmetic Shop system
Python Project On Cosmetic Shop systemPython Project On Cosmetic Shop system
Python Project On Cosmetic Shop system
 
Python Lab Manual
Python Lab ManualPython Lab Manual
Python Lab Manual
 
Mocks Enabling Test-Driven Design
Mocks Enabling Test-Driven DesignMocks Enabling Test-Driven Design
Mocks Enabling Test-Driven Design
 
Useful c programs
Useful c programsUseful c programs
Useful c programs
 
The ultimate-guide-to-sql
The ultimate-guide-to-sqlThe ultimate-guide-to-sql
The ultimate-guide-to-sql
 
Laquando Young Comp. Sci.pdf
Laquando Young Comp. Sci.pdfLaquando Young Comp. Sci.pdf
Laquando Young Comp. Sci.pdf
 
Java
JavaJava
Java
 
java-introduction.pdf
java-introduction.pdfjava-introduction.pdf
java-introduction.pdf
 
Pro Java Fx – Developing Enterprise Applications
Pro Java Fx – Developing Enterprise ApplicationsPro Java Fx – Developing Enterprise Applications
Pro Java Fx – Developing Enterprise Applications
 
C++ project on police station software
C++ project on police station softwareC++ project on police station software
C++ project on police station software
 
Statistical computing project
Statistical computing projectStatistical computing project
Statistical computing project
 
T sql denali code Day of .Net
T sql denali code Day of .NetT sql denali code Day of .Net
T sql denali code Day of .Net
 
You will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdfYou will write a multi-interface version of the well-known concentra.pdf
You will write a multi-interface version of the well-known concentra.pdf
 
Vue.js slots.pdf
Vue.js slots.pdfVue.js slots.pdf
Vue.js slots.pdf
 
How to tune a query - ODTUG 2012
How to tune a query - ODTUG 2012How to tune a query - ODTUG 2012
How to tune a query - ODTUG 2012
 
I keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdfI keep on get a redefinition error and an undefined error.Customer.pdf
I keep on get a redefinition error and an undefined error.Customer.pdf
 
How fast ist it really? Benchmarking in practice
How fast ist it really? Benchmarking in practiceHow fast ist it really? Benchmarking in practice
How fast ist it really? Benchmarking in practice
 
PYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEMPYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEM
 
Quiz using C++
Quiz using C++Quiz using C++
Quiz using C++
 
#include iostream#includectimeusing namespace std;void.docx
#include iostream#includectimeusing namespace std;void.docx#include iostream#includectimeusing namespace std;void.docx
#include iostream#includectimeusing namespace std;void.docx
 

Recently uploaded

Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 

Recently uploaded (20)

Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهله
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 

CAPE Unit1 Computer Science IA Sample .pdf

  • 1. COMPUTER SCIENCE I.A. CANDIDATE NAME: CANDIDATE NO.: SCHOOL NAME: ST. MARY’S COLLEGE CENTRE NO.: 160073 TEACHER: MR. RAMDHANIE YEAR:
  • 2. TABLE OF CONTENTS PROBLEM DESCRIPTION.......................................................................................................................................................... 3 Functional Requirements.................................................................................................................................................... 5 ............................................................................................................................................................................................ 5 Non-Functional Requirements............................................................................................................................................ 5 PSEUDOCODE.......................................................................................................................................................................... 6 TECHNICAL DOCUMENTATION ............................................................................................................................................. 22 HIPO Chart......................................................................................................................................................................... 22 Program Code ................................................................................................................................................................... 23 File Design......................................................................................................................................................................... 39 TESTING................................................................................................................................................................................. 40 Whitebox Testing with Results ......................................................................................................................................... 40 Functional Testing............................................................................................................................................................. 43 USER DOCUMENTATION....................................................................................................................................................... 48
  • 3. PROBLEM DESCRIPTION During the Christmas season, an annual dessert making competition is held by the ‘PriceSmart Inc.’ branches in Trinidad and Tobago with the winner getting a free 18 months membership. The competition is open to anyone eighteen years and older. The scoring for this competition is done manually. A judge would go to all the contestants and try their desserts. A scoresheet would be provided for each contestant and upon trying their dessert the judges would rate each section from 1(worst) to 10(great). Afterwards the total would be calculated by dividing the sum of the sections. Total = (Appearance score + Texture score + Taste score) ÷ 3 The number of competitors registered was excessive which made keeping score of all the contestants manually difficult. To resolve this problem, a program was developed to function as a database to keep track of all the contestants’ information. The program’s functionalities included insertion of contestant information, sorting of contestants' data, exporting of contestants' data to external device and importing of contestant data from an external device.
  • 5. Filled-out scorecard Functional Requirements Adding a Contestant: The system should allow the input of a contestant with all relevant information. This includes their name and their dessert’s score for each section. Calculating Total Score: The system should be able to automatically calculate the total. Display All: The system should be able to show a list of all the contestants with their respective information and total. Sort: The system should be able to automatically sort the list by contestant total in ascending and descending order. This would help determine the winner. Non-Functional Requirements User Friendly Interface: The system should be easy to maneuver and inviting to most to all users
  • 6. Data Validation: There must be a way to distinguish that all the data entered pertains to its section. This would help prevent errors in contestant records. New Sort: The system should have a more efficient sorting program. PSEUDOCODE Narrative Description: This procedure shows a welcome art to start the program. FUNCTION welcome() BEGIN OUTPUT " _ _ _______ ___ _______ _______ __ __ _______ " OUTPUT " | | _ | || || | | || || |_| || | " OUTPUT " | || || || ___|| | | _|| _ || || ___| " OUTPUT " | || |___ | | | | | | | || || |___ " OUTPUT " | || ___|| |___ | | | |_| || || ___| " OUTPUT " | _ || |___ | || |_ | || ||_|| || |___ " OUTPUT " |__| |__||_______||_______||_______||_______||_| |_||_______| " OUTPUT " +- " OUTPUT " .*- "
  • 7. OUTPUT " *: " OUTPUT " .#. " OUTPUT " -* " OUTPUT " *: " OUTPUT " == " OUTPUT " :+ " OUTPUT " :* " OUTPUT " .::::.-= " OUTPUT " =***++**#####*+=. " OUTPUT " :****: +********#: " OUTPUT " #*****+=+**********# " OUTPUT " #***************++*# " OUTPUT " #************+===** " OUTPUT " #****++++++===+*# " OUTPUT " ##**+++++++**+= " END welcome STRUCT foodcomp char comp_fname[15] char comp_lname[15] float appearance_score float texture_score float taste_score float total_score int comp_no DECLARE foodcomp foodcomp_rec[15] DECLARE int recnumber=0 Narrative Description:
  • 8. This procedure allows for the adding of a contestant’s information. FUNCTION add_competitor() BEGIN DECLARE char check DECLARE char check2 DECLARE char multi_temp[15] DECLARE int marker DECLARE int x DECLARE int appearance_box DECLARE int texture_box DECLARE int taste_box system "cls" OUTPUT "????????????????????????? Add NEW COMPETITOR :) ?????????????????????????" check = 'F' check2 = 'F' DO OUTPUT "Please enter first name" INPUT multi_temp IF(strlen(multi_temp)>15) THEN check2 ='F' OUTPUT "COMPETITOR LAST NAME HAS EXCEEDED SYSTEM LIMIT!" ELSE check2 = 'T' END IF marker = 0 FOR (x = 0; x<strlen(multi_temp); x++) IF (isdigit(multi_temp[x])>0) THEN marker = 1
  • 9. END IF END FOR IF (marker == 0) THEN check ='T' ELSE OUTPUT "INVALID VALUE ENTERED!" END IF WHILE (check =='F'OR check2 =='F') strcpy(foodcomp_rec[recnumber].comp_fname, multi_temp) check = 'F' check2 = 'F' DO OUTPUT "Please enter last name" INPUT multi_temp IF(strlen(multi_temp)>15) THEN check2 ='F' OUTPUT"COMPETITOR LAST NAME HAS EXCEEDED SYSTEM LIMIT!" ELSE check2 = 'T' END IF marker = 0; FOR (x = 0; x<strlen(multi_temp); x++) IF (isdigit(multi_temp[x])>0) THEN marker = 1 END IF END FOR
  • 10. IF (marker == 0) THEN check ='T' ELSE OUTPUT "INVALID VALUE ENTERED!" END IF WHILE (check =='F'OR check2 =='F') strcpy(foodcomp_rec[recnumber].comp_lname, multi_temp) check = 'F' DO OUTPUT "Please enter score for meal appearance(1 to 10)" INPUT multi_temp marker = 0 FOR (x = 0; x<strlen(multi_temp); x++) IF(isdigit(multi_temp[x])==0) THEN marker = 1 END IF END FOR IF (marker == 1) THEN check='F' OUTPUT"INVALID VALUE ENTERED!" ELSE appearance_box = atoi(multi_temp) IF (appearance_box< 1 OR appearance_box> 10) THEN check ='F' OUTPUT "THE VALUE ENTERED HAS EXCEEDED SYSTEM LIMIT!" ELSE check ='T'
  • 11. END IF END IF WHILE (check=='F') foodcomp_rec[recnumber].appearance_score = appearance_box check = 'F' DO OUTPUT "Please enter score for meal texture(1 to 10)" INPUT multi_temp marker = 0 FOR (x = 0; x<strlen(multi_temp); x++) IF(isdigit(multi_temp[x])==0) THEN marker = 1 END IF END FOR IF (marker == 1) THEN check='F' OUTPUT"INVALID VALUE ENTERED!" ELSE texture_box = atoi(multi_temp) IF (texture_box< 1 OR texture_box> 10) THEN check ='F' OUTPUT "THE VALUE ENTERED HAS EXCEEDED SYSTEM LIMIT!" ELSE check ='T' END IF END IF
  • 12. WHILE (check=='F') foodcomp_rec[recnumber].texture_score = texture_box check = 'F' DO OUTPUT "Please enter score for meal taste(1 to 10)" INPUT multi_temp marker = 0 FOR (x = 0; x<strlen(multi_temp); x++) IF(isdigit(multi_temp[x])==0) THEN marker = 1 END IF END FOR IF (marker == 1) THEN check='F' OUTPUT"INVALID VALUE ENTERED!" ELSE taste_box = atoi(multi_temp) IF (taste_box< 1 OR taste_box> 10) THEN check ='F' OUTPUT "THE VALUE ENTERED HAS EXCEEDED SYSTEM LIMIT!" ELSE check ='T' END IF END IF
  • 13. WHILE (check=='F') foodcomp_rec[recnumber].taste_score = taste_box foodcomp_rec[recnumber].total_score = (foodcomp_rec[recnumber].appearance_score + foodcomp_rec[recnumber].texture_score + foodcomp_rec[recnumber].taste_score)/3 OUTPUT "Total Score = ", foodcomp_rec[recnumber].total_score recnumber = recnumber + 1 END add_competitor Narrative Description: This procedure allows the user to display all the information for the contestants on record. FUNCTION allcompetitors() BEGIN DECLARE int i; foodcomp_rec[recnumber].comp_no = 0; system "cls" OUTPUT "????????????????????????? RECORDS (._.)?????????????????????????" FOR (i=0;i<recnumber;i++){ foodcomp_rec[recnumber].comp_no++; OUTPUT "Competitor No.",foodcomp_rec[recnumber].comp_no OUTPUT "First Name: ",foodcomp_rec[i].comp_fname OUTPUT "Last Name: ",foodcomp_rec[i].comp_lname OUTPUT "Appearance Score = ",foodcomp_rec[i].appearance_score OUTPUT "Texture Score = ",foodcomp_rec[i].texture_score OUTPUT "Taste Score = ",foodcomp_rec[i].taste_score OUTPUT "Total Score = ",foodcomp_rec[i].total_score
  • 14. OUTPUT "----------------------" END FOR system "pause" END allcompetitors Narrative Description: This procedure allows the user to sort the data entered by ascending or descending order using a bubble sort. FUNCTION sort_competitors() BEGIN DECLARE int a DECLARE int b DECLARE int x DECLARE int checkmrk DECLARE int marker = 1 DECLARE char fnme_box[15] DECLARE char lnme_box[15] DECLARE char check DECLARE char check2 DECLARE char multi_temp[15] DECLARE int sort_type DECLARE float total_box DECLARE float appearance_boX DECLARE float taste_box DECLARE float texture_box system "cls" OUTPUT "????????????????????????? SORT ('o')?????????????????????????" check ='F'
  • 15. DO OUTPUT "Choose Sort Type:(1)Ascending (2)Descending" INPUT multi_temp marker = 0; FOR (x = 0; x<strlen(multi_temp); x++) IF(isdigit(multi_temp[x])==0) THEN marker = 1 END IF END FOR IF (marker == 1) THEN check ='F' OUTPUT "INVALID VALUE!" ELSE sort_type = atoi(multi_temp) IF(sort_type==1 OR sort_type==2)THEN check ='T' ELSE check ='F' OUTPUT "INVALID ENTRY!" END IF END IF WHILE (check=='F') FOR(a=1;(a <= recnumber)&& checkmrk; a++) checkmrk = 0; FOR (b=0; b < (recnumber -1); b++) IF(sort_type== 1) THEN IF (foodcomp_rec[b+1].total_score < foodcomp_rec[b].total_score) THEN
  • 16. strcpy(fnme_box,foodcomp_rec[b].comp_fname) strcpy(foodcomp_rec[b].comp_fname, foodcomp_rec[b+1].comp_fname) strcpy(foodcomp_rec[b+1].comp_fname, fnme_box) strcpy(lnme_box,foodcomp_rec[b].comp_lname) strcpy(foodcomp_rec[b].comp_lname, foodcomp_rec[b+1].comp_lname) strcpy(foodcomp_rec[b+1].comp_lname, lnme_box) total_box = foodcomp_rec[b].total_score foodcomp_rec[b].total_score = foodcomp_rec[b+1].total_score foodcomp_rec[b+1].total_score = total_box appearance_box= foodcomp_rec[b].appearance_score foodcomp_rec[b].appearance_score = foodcomp_rec[b+1].appearance_score foodcomp_rec[b+1].appearance_score = appearance_box taste_box = foodcomp_rec[b].taste_score foodcomp_rec[b].taste_score = foodcomp_rec[b+1].taste_score foodcomp_rec[b+1].taste_score = taste_box texture_box = foodcomp_rec[b].texture_score foodcomp_rec[b].texture_score = foodcomp_rec[b+1].texture_score foodcomp_rec[b+1].texture_score = texture_box checkmrk = 1 END IF ELSE IF (sort_type== 2) THEN IF (foodcomp_rec[b+1].total_score > foodcomp_rec[b].total_score) THEN
  • 17. strcpy(fnme_box,foodcomp_rec[b].comp_fname) strcpy(foodcomp_rec[b].comp_fname, foodcomp_rec[b+1].comp_fname) strcpy(foodcomp_rec[b+1].comp_fname, fnme_box) strcpy(lnme_box,foodcomp_rec[b].comp_lname) strcpy(foodcomp_rec[b].comp_lname, foodcomp_rec[b+1].comp_lname) strcpy(foodcomp_rec[b+1].comp_lname, lnme_box) total_box = foodcomp_rec[b].total_score foodcomp_rec[b].total_score = foodcomp_rec[b+1].total_score foodcomp_rec[b+1].total_score = total_box appearance_box= foodcomp_rec[b].appearance_score foodcomp_rec[b].appearance_score = foodcomp_rec[b+1].appearance_score foodcomp_rec[b+1].appearance_score = appearance_box taste_box = foodcomp_rec[b].taste_score foodcomp_rec[b].taste_score = foodcomp_rec[b+1].taste_score foodcomp_rec[b+1].taste_score = taste_box texture_box = foodcomp_rec[b].texture_score foodcomp_rec[b].texture_score = foodcomp_rec[b+1].texture_score foodcomp_rec[b+1].texture_score = texture_box checkmrk = 1 END IF END IF END FOR END FOR
  • 18. OUTPUT "Record of Competitors Sorted" system"pause" END sort_competitors Narrative Description: This procedure allows the user to export all the records onto a separate text file FUNCTION record_export() BEGIN DECLARE int x FILE * exportfile exportfile = fopen("FoodExport.txt","w+") fprintf(exportfile, "%dn", recnumber) FOR(x=0;x<recnumber;x++) OUTPUT exportfile, " ", foodcomp_rec[x].comp_fname) OUTPUT exportfile, " ", foodcomp_rec[x].comp_lname) OUTPUT exportfile, " ", foodcomp_rec[x].appearance_score) OUTPUT exportfile, " ", foodcomp_rec[x].texture_score) OUTPUT exportfile, " ", foodcomp_rec[x].taste_score) OUTPUT exportfile, " ", foodcomp_rec[x].total_score) END FOR fclose(exportfile) OUTPUT "File Data Exported" system "pause" END record_export
  • 19. Narrative Description: This procedure allows the user to import contestant records from a text file FUNCTION record_import() BEGIN DECLARE int y system"cls" OUTPUT "????????????????????????? IMPORTED RECORDS (.-.)?????????????????????????" FILE * importfile; importfile = fopen("FoodExport.txt","r") fscanf(importfile, " ",recnumber ) foodcomp_rec[recnumber].comp_no = 0 FOR(y=0;y<recnumber;y++) fscanf(importfile, " ", foodcomp_rec[y].comp_fname) fscanf(importfile, " ", foodcomp_rec[y].comp_lname) fscanf(importfile, " ", &foodcomp_rec[y].appearance_score) fscanf(importfile, " ", &foodcomp_rec[y].texture_score) fscanf(importfile, " ", &foodcomp_rec[y].taste_score) fscanf(importfile, " ", &foodcomp_rec[y].total_score) foodcomp_rec[recnumber].comp_no = foodcomp_rec[recnumber].comp_no + 1 OUTPUT "Competitor No. ",foodcomp_rec[recnumber].comp_no OUTPUT "First Name: ",foodcomp_rec[y].comp_fname OUTPUT "Last Name: ",foodcomp_rec[y].comp_lname OUTPUT "Appearance Score = ",foodcomp_rec[y].appearance_score OUTPUT "Texture Score = ",foodcomp_rec[y].texture_score OUTPUT "Taste Score = ",foodcomp_rec[y].taste_score OUTPUT "Total Score = ",foodcomp_rec[y].total_score OUTPUT "----------------------"
  • 20. END FOR fclose(importfile); OUTPUT "File Data Imported" system"pause" END record_import Narrative Description: This procedure allows the user to maneuver to the different procedures as it is the main menu main() BEGIN DECLARE char section welcome() system"pause" DO system"cls" OUTPUT " --------------------------- " OUTPUT " | MAIN MENU | " OUTPUT " --------------------------- " OUTPUT " |1. Add New Competitor | " OUTPUT " |2. Record of All Entries | " OUTPUT " |3. Sort Records | " OUTPUT " |4. Export All Records | " OUTPUT " |5. Import Data From File | " OUTPUT " |6. Exit | " OUTPUT " --------------------------- " OUTPUT " Please select an option: " INPUT section
  • 21. switch (section) case '1': add_competitor() break case '2': allcompetitors() break case '3': sort_competitors() break case '4': record_export() break case '5': record_import() break; case '6': record_export() break default: OUTPUT "INVALID CHOICE!" system "pause" break; END switch WHILE (section <>'6') END main
  • 23. Program Code #include <stdio.h> #include <iostream> #include <windows.h>
  • 24. using namespace std; void welcome(void){//module welcome displays start art printf(" _ _ _______ ___ _______ _______ __ __ _______n"); printf(" | | _ | || || | | || || |_| || |n"); printf(" | || || || ___|| | | _|| _ || || ___|n"); printf(" | || |___ | | | | | | | || || |___ n"); printf(" | || ___|| |___ | | | |_| || || ___|n"); printf(" | _ || |___ | || |_ | || ||_|| || |___ n"); printf(" |__| |__||_______||_______||_______||_______||_| |_||_______|n"); printf(" +-n"); printf(" .*-n"); printf(" *:n"); printf(" .#.n"); printf(" -*n"); printf(" *:n"); printf(" ==n"); printf(" :+n"); printf(" :*n"); printf(" .::::.-=n"); printf(" =***++**#####*+=.n"); printf(" :****: +********#:n"); printf(" #*****+=+**********#n"); printf(" #***************++*#n"); printf(" #************+===**n"); printf(" #****++++++===+*#n"); printf(" ##**+++++++**+=n"); }//end of welcome
  • 25. //???????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????? typedef struct {//structure to store variables char comp_fname[15];//first name limit char comp_lname[15];//last name limit float appearance_score, texture_score, taste_score; float total_score; int comp_no;//competitor number } foodcomp; foodcomp foodcomp_rec[15]; int recnumber=0; //???????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????? void add_competitor (){//this module allows for contestants to be added char check, check2, multi_temp[15]; int marker, x, appearance_box, texture_box, taste_box; system ("cls"); printf("????????????????????????? Add NEW COMPETITOR :) ?????????????????????????n");//addplayer banner check = 'F'; check2 = 'F';//set first name Validation do{ printf("Please enter first namen"); scanf("%s",multi_temp);//save value in temporary variable if(strlen(multi_temp)>15){ check2 ='F';
  • 26. printf("COMPETITOR FIRST NAME HAS EXCEEDED SYSTEM LIMIT!n");//validation prompt for character limit }else{ check2 = 'T'; } marker = 0; for(x = 0; x<strlen(multi_temp); x++){ if(isdigit(multi_temp[x])>0){ marker = 1; } } if (marker == 0){ check ='T'; }else{ printf("INVALID VALUE ENTERED!n");//validation prompt for data type check } }while (check =='F'|| check2 =='F'); strcpy(foodcomp_rec[recnumber].comp_fname, multi_temp);//End of Validation (firstname) for field type and field size check = 'F'; check2 = 'F';//Reset checks for last name Validation do{ printf("Please enter last namen"); scanf("%s",multi_temp);//save value in temporary variable if(strlen(multi_temp)>15){ check2 ='F'; printf("COMPETITOR LAST NAME HAS EXCEEDED SYSTEM LIMIT!n");//validation prompt for character limit }else{
  • 27. check2 = 'T'; } marker = 0; for(x = 0; x<strlen(multi_temp); x++){ if(isdigit(multi_temp[x])>0){ marker = 1; } } if (marker == 0){ check ='T'; }else{ printf("INVALID VALUE ENTERED!n"); } }while (check =='F'|| check2 =='F'); strcpy(foodcomp_rec[recnumber].comp_lname, multi_temp);//End of Validation (lastname) for field type and field size check = 'F';//Reset checks for appearance validation do{ printf("Please enter score for meal appearance(1 to 10)n"); scanf("%s",&multi_temp); marker = 0; for(x = 0; x<strlen(multi_temp); x++){ if(isdigit(multi_temp[x])==0){ marker = 1; } } if (marker == 1){ check='F';
  • 28. printf("INVALID VALUE ENTERED!n"); }else{ appearance_box = atoi(multi_temp);//change field type for number limit check if(appearance_box< 1 || appearance_box> 10){ check ='F'; printf("THE VALUE ENTERED HAS EXCEEDED SYSTEM LIMIT!n"); }else{ check ='T'; } } }while(check=='F'); foodcomp_rec[recnumber].appearance_score = appearance_box;//Validation for appearance field type and limit check = 'F';//Reset checks for texture validation do{ printf("Please enter score for meal texture(1 to 10)n"); scanf("%s",&multi_temp); marker = 0; for(x = 0; x<strlen(multi_temp); x++){ if(isdigit(multi_temp[x])==0){ marker = 1; } } if (marker == 1){
  • 29. check='F'; printf("INVALID VALUE ENTERED!n"); }else{ texture_box = atoi(multi_temp);//change field type for number limit check if(texture_box< 1 || texture_box> 10){ check ='F'; printf("THE VALUE ENTERED HAS EXCEEDED SYSTEM LIMIT!n"); }else{ check ='T'; } } }while(check=='F'); foodcomp_rec[recnumber].texture_score = texture_box;//Validation for texture field type and limit check = 'F';//Reset checks for taste validation do{ printf("Please enter score for meal taste(1 to 10)n"); scanf("%s",&multi_temp); marker = 0; for(x = 0; x<strlen(multi_temp); x++){ if(isdigit(multi_temp[x])==0){ marker = 1; } } if (marker == 1){ check ='F'; printf("INVALID VALUE ENTERED!n");
  • 30. }else{ taste_box = atoi(multi_temp);//change field type for number limit check if(taste_box< 1 || taste_box> 10){ check ='F'; printf("THE VALUE ENTERED HAS EXCEEDED SYSTEM LIMIT!n"); }else{ check ='T'; } } }while(check=='F'); foodcomp_rec[recnumber].taste_score = taste_box;//Validation for taste field type and limit foodcomp_rec[recnumber].total_score = (foodcomp_rec[recnumber].appearance_score + foodcomp_rec[recnumber].texture_score + foodcomp_rec[recnumber].taste_score)/3;//total calculations printf("Total Score = %2.1f", foodcomp_rec[recnumber].total_score); recnumber++; getchar(); getchar(); }//end of add_player //???????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????? void allcompetitors(){//this module displays all contestants int i; foodcomp_rec[recnumber].comp_no = 0;
  • 31. system("cls"); printf("????????????????????????? RECORDS (._.)?????????????????????????n");//display all banner for(i=0;i<recnumber;i++){ foodcomp_rec[recnumber].comp_no++; printf("Competitor No.%dn",foodcomp_rec[recnumber].comp_no); printf("First Name: %sn",foodcomp_rec[i].comp_fname); printf("Last Name: %sn",foodcomp_rec[i].comp_lname); printf("Appearance Score = %2.1fn",foodcomp_rec[i].appearance_score); printf("Texture Score = %2.1fn",foodcomp_rec[i].texture_score); printf("Taste Score = %2.1fn",foodcomp_rec[i].taste_score); printf("Total Score = %2.1fn",foodcomp_rec[i].total_score); printf("----------------------n");//record separater } system("pause"); }//end of display all //???????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????? void sort_competitors(){//This module uses a bubble sort to sort the records in display all int a, b,x, checkmrk, marker = 1; char fnme_box[15]; char lnme_box[15], check, check2, multi_temp[15]; int sort_type; float total_box, appearance_box, taste_box, texture_box; system("cls"); printf("????????????????????????? SORT ('o')?????????????????????????n");//sort banner
  • 32. check ='F'; do{ printf("Choose Sort Type:(1)Ascending (2)Descendingn"); scanf("%s",&multi_temp); marker = 0; for(x = 0; x<strlen(multi_temp); x++){ if(isdigit(multi_temp[x])==0){ marker = 1; } }//For if (marker == 1){ check ='F'; printf("INVALID VALUE!n");//validation prompt }else{ sort_type = atoi(multi_temp);//change field type for number limit check if(sort_type==1||sort_type==2){ check ='T'; }else{ check ='F'; printf("INVALID ENTRY!n"); } } }while(check=='F'); for(a=1;(a <= recnumber)&& checkmrk; a++){ checkmrk = 0; for(b=0; b < (recnumber -1); b++){ if(sort_type== 1){
  • 33. if (foodcomp_rec[b+1].total_score < foodcomp_rec[b].total_score){//ascending order strcpy(fnme_box,foodcomp_rec[b].comp_fname); strcpy(foodcomp_rec[b].comp_fname, foodcomp_rec[b+1].comp_fname); strcpy(foodcomp_rec[b+1].comp_fname, fnme_box); strcpy(lnme_box,foodcomp_rec[b].comp_lname); strcpy(foodcomp_rec[b].comp_lname, foodcomp_rec[b+1].comp_lname); strcpy(foodcomp_rec[b+1].comp_lname, lnme_box); total_box = foodcomp_rec[b].total_score; foodcomp_rec[b].total_score = foodcomp_rec[b+1].total_score; foodcomp_rec[b+1].total_score = total_box; appearance_box= foodcomp_rec[b].appearance_score; foodcomp_rec[b].appearance_score = foodcomp_rec[b+1].appearance_score; foodcomp_rec[b+1].appearance_score = appearance_box; taste_box = foodcomp_rec[b].taste_score; foodcomp_rec[b].taste_score = foodcomp_rec[b+1].taste_score; foodcomp_rec[b+1].taste_score = taste_box; texture_box = foodcomp_rec[b].texture_score; foodcomp_rec[b].texture_score = foodcomp_rec[b+1].texture_score; foodcomp_rec[b+1].texture_score = texture_box; checkmrk = 1; }//end if } else if(sort_type== 2){
  • 34. if (foodcomp_rec[b+1].total_score > foodcomp_rec[b].total_score){//descending order strcpy(fnme_box,foodcomp_rec[b].comp_fname); strcpy(foodcomp_rec[b].comp_fname, foodcomp_rec[b+1].comp_fname); strcpy(foodcomp_rec[b+1].comp_fname, fnme_box); strcpy(lnme_box,foodcomp_rec[b].comp_lname); strcpy(foodcomp_rec[b].comp_lname, foodcomp_rec[b+1].comp_lname); strcpy(foodcomp_rec[b+1].comp_lname, lnme_box); total_box = foodcomp_rec[b].total_score; foodcomp_rec[b].total_score = foodcomp_rec[b+1].total_score; foodcomp_rec[b+1].total_score = total_box; appearance_box= foodcomp_rec[b].appearance_score; foodcomp_rec[b].appearance_score = foodcomp_rec[b+1].appearance_score; foodcomp_rec[b+1].appearance_score = appearance_box; taste_box = foodcomp_rec[b].taste_score; foodcomp_rec[b].taste_score = foodcomp_rec[b+1].taste_score; foodcomp_rec[b+1].taste_score = taste_box; texture_box = foodcomp_rec[b].texture_score; foodcomp_rec[b].texture_score = foodcomp_rec[b+1].texture_score; foodcomp_rec[b+1].texture_score = texture_box; checkmrk = 1; }//end if } }//END FOR2
  • 35. }//END FOR1 printf("nRecord of Competitors Sortedn"); system("pause"); return; }//end of bubbleSort //???????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????? void record_export(){//This module exports all the records to an external file int x; FILE * exportfile; exportfile = fopen("FoodExport.txt","w+");//file given a name fprintf(exportfile, "%dn", recnumber); for(x=0;x<recnumber;x++){ fprintf(exportfile, "%sn", foodcomp_rec[x].comp_fname); fprintf(exportfile, "%sn", foodcomp_rec[x].comp_lname); fprintf(exportfile, "%2.1fn", foodcomp_rec[x].appearance_score); fprintf(exportfile, "%2.1fn", foodcomp_rec[x].texture_score); fprintf(exportfile, "%2.1fn", foodcomp_rec[x].taste_score); fprintf(exportfile, "%2.1fn", foodcomp_rec[x].total_score); } fclose(exportfile); printf("File Data Exportedn");//tells user that all the data has been exported system("pause"); }//end of export
  • 36. //???????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????? void record_import(){//This module imports data from the external file int y; system("cls");//cear screen printf("????????????????????????? IMPORTED RECORDS (.-.)?????????????????????????n");//import banner FILE * importfile; importfile = fopen("FoodExport.txt","r");// fscanf(importfile, "%dn",&recnumber ); foodcomp_rec[recnumber].comp_no = 0; for(y=0;y<recnumber;y++){ fscanf(importfile, "%sn", foodcomp_rec[y].comp_fname); fscanf(importfile, "%sn", foodcomp_rec[y].comp_lname); fscanf(importfile, "%dn", &foodcomp_rec[y].appearance_score); fscanf(importfile, "%dn", &foodcomp_rec[y].texture_score); fscanf(importfile, "%dn", &foodcomp_rec[y].taste_score); fscanf(importfile, "%2.1fn", &foodcomp_rec[y].total_score); foodcomp_rec[recnumber].comp_no++; printf("Competitor No.%dn",foodcomp_rec[recnumber].comp_no); printf("First Name: %sn",foodcomp_rec[y].comp_fname); printf("Last Name: %sn",foodcomp_rec[y].comp_lname); printf("Appearance Score = %dn",foodcomp_rec[y].appearance_score); printf("Texture Score = %dn",foodcomp_rec[y].texture_score); printf("Taste Score = %dn",foodcomp_rec[y].taste_score); printf("Total Score = %2.1fn",foodcomp_rec[y].total_score); printf("----------------------n");
  • 37. } fclose(importfile); printf("File Data Imported");//tells user that all the data has been imported system("pause");//press any key to continue }//end of import //???????????????????????????????????????????????????????????????????????????????????????????????????? ??????????????????????????????????????????????????????????????????? int main() {//This is the main menu char section; welcome();//module welcome system("pause"); do { system("cls"); //clears the screen printf(" ---------------------------n"); printf(" | MAIN MENU |n"); printf(" ---------------------------n"); printf(" |1. Add New Competitor |n"); printf(" |2. Record of All Entries |n"); printf(" |3. Sort Records |n"); printf(" |4. Export All Records |n"); printf(" |5. Import Data From File |n"); printf(" |6. Exit |n"); printf(" ---------------------------n"); printf(" Please select an option:n"); scanf ("%s",&section);
  • 38. switch (section){ case '1': add_competitor(); break; case '2': allcompetitors(); break; case '3': sort_competitors(); break; case '4': record_export(); break; case '5': record_import(); break; case '6': record_export();//This exports the records before closing the program break; default: printf("INVALID CHOICE!n"); system("pause"); break; }//end switch } while (section != '6'); }//end of mainmenu
  • 39. File Design Variable Name Data Type Length Description Sample Data comp_fname char 15 Holds the first name of the contestant Moon comp_lname char 15 Holds the last name of the contestant Ley appearance_score float 4 Holds the appearance score of the contestant's dessert 7 texture_score float 4 Holds the texture score of the contestant's dessert 6 taste_score float 4 Holds the taste score of the contestant's dessert 8 total_score float 4 Holds the total score the contestant made 7 comp_no int 4 Holds the contestant entry number 1
  • 40. TESTING Whitebox Testing with Results Variable Name Data Type Length Test Test Data Results Expected Actual comp_fname char 15 Normal Moon Accepted Accepted Extreme abcdefghijklmno Accepted Accepted Abnormal abcdefghijklmnop Rejected Rejected comp_lname char 15 Normal Ley Accepted Accepted Extreme abcdefghijklmno Accepted Accepted Abnormal abcdefghijklmnop Rejected Rejected appearance_score float 4 Normal 7 Accepted Accepted Extreme 10 Accepted Accepted Abnormal 11 Rejected Rejected texture_score float 4 Normal 6 Accepted Accepted Extreme 10 Accepted Accepted Abnormal 11 Rejected Rejected taste_score float 4 Normal 8 Accepted Accepted Extreme 10 Accepted Accepted Abnormal 11 Rejected Rejected total_score float 4 Calculated Field comp_no int 4 Calculated Field
  • 43. Abnormal Data Test Functional Testing Add_player Test 1. User creates a contestant record using their information
  • 44. Display_All Test 2. Displays all contestant records inputted
  • 45. Sort Test 3. Uses bubble sort to sort the record in ascending or descending order Ascending
  • 47. Export Test 4. The user can copy the records to an external file Before After
  • 48. USER DOCUMENTATION How to Navigate the Main Menu? To select any of the options in the main menu type in the number (1, 2, 3...) relevant then press ‘Enter’ To Add a Record. To add a record for a contestant, select ‘1’ in the main menu then press ‘Enter’. The screen would change and you should see a banner at the top saying ‘Add a New Competitor’. Finally, follow the prompts and fill out the necessary information. To Display all Records To display all current records, select ‘2’ in the main menu the press ‘Enter’. The screen would change and you should see a banner at the top saying ‘Records’. There you should see all current records. If there are no records the screen would just show the banner only. To Sort all Records To sort all records, select ‘3’ in the main menu the press ‘Enter’. The screen would change and you should see a banner at the top saying ‘Sort’. There you should follow the prompts and choose a sort option. After selecting your choice, a verification would appear in the next line. To check your sorted records, check the ‘Display All’ option in the main menu.