0% found this document useful (0 votes)
125 views24 pages

My CAPE Computer Science Internal Assessment

This document outlines an internal assessment project for a Computer Science course which involves creating a program to help a company manage employee records and identify those with poor performance to potentially fire. It provides background on the company, outlines the current manual process, and proposes a program to store and search employee data including name, ID, age, and performance level. Pseudocode is included to define functions for searching records, adding new records, deleting records, and the overall program flow.

Uploaded by

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

My CAPE Computer Science Internal Assessment

This document outlines an internal assessment project for a Computer Science course which involves creating a program to help a company manage employee records and identify those with poor performance to potentially fire. It provides background on the company, outlines the current manual process, and proposes a program to store and search employee data including name, ID, age, and performance level. Pseudocode is included to define functions for searching records, adding new records, deleting records, and the overall program flow.

Uploaded by

rod-vaughn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

1.

CAPE Computer Science Internal Assessment

Subject: Computer Science


Candidate Name: Rod-vaughn Reynolds
Teacher: Mr.Kirui
Candidate's Number: 100107
School: St.George's College
Centre Number: 1001071937
Table of Contents

Introduction………………………………………………….

Narrative……………………………………………………..

Pseudocode………………………...................................

Code……………………………………….

Test Plan……………………………………………………..

Communication of Information………………………....
Introduction

This Internal Assessment would be able to assist Companies in searching for their
employees and displaying their job performance. The objective of this internal assessment is
to give a brief history and specifics of an organization.Afterwards the problem that the
organisation is having is going to be stated and a solution to the problem will be given.The
solution to the problem will be created using C program.

A company known as T.F.T.F(Terrific Future Technology Foundation) is currently located in


Finland.It was founded in March,2006 by Mr.Performances second wife Veronica.The
number of employees currently working at T.F.T.F is thirty.The contact number is
+(358)3382415.The purpose of the organisation is to create and bring terrific and life
changing products to mass markets such as the United States and other emerging
countries.Recently the company was forced to close their doors to help control the spread of
the corona virus.With the company's revenue reduced by the shutdown the chief human
resources officer,Gilmore, wishes for the company to downsize by firing the employees with
a dreadful job performance.
The company currently utilises a manual system to record the i.d number,surname,first
name,Age and Job Performance of its employees.The company placed a value on their job
performance status.
1-Excellent
2-Satisfactory
3-Dreadful
In this system ,the company utilises a pen,ruler,paper and a folder in order to record
the first name,surname,age,id and job performance of each of its employees.

T.F.T.F finds the current system very tedious as well as time consuming.The reason for this
is that they have to write up the employees job performance,age,id number,surname and
first name by hand and also every time they need to search for a employees file they have to
look through a lot of different folders and just hope that they find it.

The chief human resources officer wants to have a system to search for the employees who
have dreadful performance so he can fire them to help downsize T.F.T.F.

A program should be created that stores the names of the employees,their id number,their
age, and their job performance status.When the company enters the i.d number of an
employee they should gain access to details of the employee.

The program that will be created should be able to search the array and display/output to
the screen for the company to view details of the employee.It should also be able to output
to the screen"This employee is to remain at Terrific Future Technology Foundation"if
employee has a status of 1 and output to the screen"Employee is to be fired immediately"if
employee status is 2 or three.It should also be able to add employee records as well as
delete employee records.
Narrative

Procedure: Main

START
Display company name
Display company slogan
Welcome user to the system

Ask the user how many employee record they want to add

Once the user enters how much employee record they want to add allow them to enter
employee details

Display a menu for the user to select a choice


if the option chosen by the user is 1
Call the function emp_search

if the option chosen by the user is 2


Call the function build

if the option chosen by the user is 3


Call the function deleteRecord

if the option chosen by the user is 4


Call the function exit

STOP

Procedure: emp_search

START
Prompt the user to enter employee id to be searched
if the user enters a employee id
Get the employee details based on employee id entered

if e[c].id=id and e[c].status is greater than one


Do the following
Get employee firstname
Get employee surname
Get employee id
Get employee status
Get employee age
Display the message" Employee is to be fired immediately"

if e[c].id=id and e[c].status is less than or equal to one however,


Do the following
Get employee firstname
Get employee surname
Get employee id
Get employee status
Get employee age
Display the message"This employee is to remain at Terrific Future Technology
Foundation"
STOP

Procedure: build
START
Display company name
Display company slogan
Welcome user to the system

Ask the user how many employee record they want to add

Once the user enters how much employee record they want to add allow them to enter
employee details

Prompt the user to enter details of employee

Prompt the user to enter employee firstname


read first name
Prompt the user to enter employee surname
read surname
Prompt the user to enter employee id
read id
Prompt the user to enter employee status
read status
Prompt the user to enter employee age
read employee age

STOP

Procedure: deleteRecord
START

Prompt the user to enter id to delete the details of a employee


If the user enters a id number of a employee
Do the following
read id
call deleteIndex function
Delete the details of that employee

STOP

Procedure: exit
START
Exit the program
Stop
Pseudocode

/*

Name:Rod-vaughn Reynolds
Date Created: May 9,2022
Program Purpose: The purpose of the program is to add and display the
details of the employees who work at Terrific Future Technology
Foundation.

*/
start

create record
id as integer
surname as string
firstname as string
age as integer
status as status

create record e as array[30]

Declare c as integer
Declare size as integer
Declare num as integer
Declare n as integer
Declare i as integer
Declare ch as integer

define function as addrec

/* read the information from the file */


FILE * in= fopen ("company.txt","r")

/*open file for writing */


while(!feof(in)) do
input e[c].id
input e[c]surname
input e[c].firstname
input e[c].age
input e[c].status
c=c+1
size=size+1

/* A test to check if tHE items in the file named company.docx will be


printed out */
for(c=0 to size) do

output e[c].id
output e[c].surname
output e[c].firstname
output e[c].age
output e[c].status
endfor

define function as emp_search(int n)

int id,i;
output "Enter Employee-Id to be Searched : "
input id
output "----------------------------------------"
for(i=0 to n;i+1) do

if(e[c].id==id) &&(e[c].status>1)

output "Employee Id : ,e[c].id "


output "SurName : ,e[c].surname "
output "FirstName : ,e[c].firstname "
output "Age : ,e[c].age "
output "Status : ,e[c].status "
output "Employee is to be fired immediately "

else if(e[c].id==id)&&(e[c].status<=1)

output "Employee Id : ,e[c].id "


output "SurName : ,e[c].surname "
output "FirstName : ,e[c].firstname"
output "Age : ,e[c].age "
output "Status : ,e[c].status "
output "This employee is to remain at Terrific Future
Technology Foundation"

endif
endfor

// END emp_search FUNCTION

define function as build(int n )// the purpose of this function is to display a


list of employees

output " TERRIFIC FUTURE TECHNOLOGY FOUNDATION"


output " providing the tech our world needs "
output " EMPLOYEE MANAGEMENT SYSTEM "
output " ====================================="

printf " WELCOME USER! "


output" *How Many Employee Record Do You Want to Add*/\n\nEnter
Limit : "
input n
for(i=0 to n;i+1)//purpose is to scan and output employee details

output"-----------------------------------------");
output("\n\tEnter Details of Employee-%d",i+1);
output("\n-----------------------------------------");
output"\nFirstName of Employee : "
input firstname
output"\nSurName of Employee : "
input surname
output"Employee-Id :"
input id
output"Status : "
input status
output"Age : "
input age

endfor
// END build FUNCTION

// Function to delete record at index i


define function as deleteIndex(int n)

for (int c = n to num - 1; c+1)


e[c].firstname == e[c + 1].firstname
e[c].surname == e[c + 1].surname
e[c].id = e[c + 1].id

e[c].status = e[c + 1].status


e[c].age = e[c + 1].age
endfor
// END deleteIndex FUNCTION
// Function to delete record
define function as deleteRecord(int n)

output"Enter the Employee ID "


output"to Delete Record"

int id

input id
for (int n = 0 to num; n+1)
if (e[c].id == id)
deleteIndex(n)
num--
break
endif
endfor
// END deleteRecord FUNCTION

int main()

output"\n TERRIFIC FUTURE TECHNOLOGY FOUNDATION"


output"\n providing the tech our world needs "
output"\n EMPLOYEE MANAGEMENT SYSTEM"
output"\n ====================================="

output"\n\n WELCOME USER! "

output"\n *How Many Employee Record Do You Want to


Add*/\n\nEnter Limit : "
input n
for(i=0 to n;i+1)//purpose is to scan and output employee details

output"-----------------------------------------"
printf"\n\tEnter Details of Employee-%d",i+1"
printf"\n-----------------------------------------"
printf"\nFirstName of Employee : "
input firstname
printf"\nSurName of Employee : "
input surname
output"Employee-Id :"
input id
output"Status : "
input status
output"Age : "
input age

while(1)

output "-----------------------------------------"
output "Available Options:\n\n"
output "-----------------------------------------"
output "1:Search Employee by E-ID"
output "\n 2:Add empRecords"
output " \n 3:Delete Record " "
output " 4:Exit"
output "----------------------------------------"
output "Enter Your Choice : "
input ch
switch(ch)

case 1: emp_search(n)
break
case 2: build(n)
break
case 3: deleteRecord(n)
break
case 4: exit(0)

return 0

stop
Code

/*

Name:Rod-vaughn Reynolds
Date Created: May 9,2022
Program Purpose: The purpose of the program is to add and display the
details of the employees who work at Terrific Future Technology
Foundation.

*/

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>

struct record{

int id;
char surname[100];
char firstname[100];
int age;
int status;
};
struct record e[30];

int num;
int c = 0;
int size=0;
int n,i,ch;

int addrec()// the purpose of this function is to scan employee


i.d,surname,firstname,age and status
{
/* read the information from the file */
FILE * in= fopen ("company.txt","r");

while(!feof(in))// the purpose of this for loop is to input employee


i.d,surname,firstname,age and status
{
fscanf(in,"%d",&e[c].id);// purpose is to scan employee i.d
fscanf(in,"%s",&e[c].surname);// purpose is to scan employee
surname
fscanf(in,"%s",&e[c].firstname);// purpose is to scan employee
firstname
fscanf(in,"%d",&e[c].age);// purpose is to scan employee age
fscanf(in,"%d",&e[c].status);// purpose is to scan employee status
c++;
size++;

}
/* A test to check if tHE items in the file named company.docx will be
printed out */
for(c=0;c<size;c++)// the purpose of this for loop is to output employee
i.d,surname,firstname,age and status
{
printf("%d\n",e[c].id);// purpose is to output employee i.d
printf("%s\n",e[c].surname);// purpose is to output employee
surname
printf("%s\n",e[c].firstname);// purpose is to output employee
firstname
printf("%d\n",e[c].age);// purpose is to output employee age
printf("%d\n\n",e[c].status);// purpose is to output employee status
}

}// END addrec FUNCTION

void emp_search(int n)// the purpose of this function is to search


employees by i.d
{
int id,i;
printf("\nEnter Employee-Id to be Searched : ");
scanf("%d",&id);
printf("----------------------------------------\n");
for(i=0;i<n;i++)// the purpose of this for loop is to output employee
i.d,surname,firstname,age and status
{
if(e[c].id==id&&e[c].status>1)
{
printf("Employee Id : %d",e[c].id);// purpose is to output
employee i.d
printf("\nSurName : %s",e[c].surname);// purpose is to
output employee surname
printf("\nFirstName : %s",e[c].firstname);// purpose is to
output employee firstname
printf("\nAge : %d\n",e[c].age);// purpose is to output
employee age
printf("\nStatus :%d\n\n",e[c].status);// purpose is to output
employee status
printf("\n\n Employee is to be fired immediately \n\n ");//
purpose is to display" Employee is to be fired immediately "
}
else if(e[c].id==id&&e[c].status<=1)
{

printf("\n SurName : %s",e[c].surname);// purpose is to output


employee surname
printf("\n FirstName : %s",e[c].firstname);// purpose is to output
employee firstname
printf("\n Age : %d\n",e[c].age);//purpose is to output
employee age
printf("\n Status : %d",e[c].status);//purpose is to output
employee status
printf("\n Employee ID: %d",e[c].id);// purpose is to output
employee i.d
printf("\n\n This employee is to remain at Terrific Future
Technology Foundation \n\n ");
}
}

}// END emp_search FUNCTION

void build(int n)// the purpose of this function is to display a list of


employees
{

printf("\n TERRIFIC FUTURE TECHNOLOGY FOUNDATION");


printf("\n providing the tech our world needs ");
printf("\n EMPLOYEE MANAGEMENT SYSTEM");
printf("\n =====================================");

printf("\n\n WELCOME USER! ");

printf("\n *How Many Employee Record Do You Want to


Add*/\n\nEnter Limit : ");
scanf("%d",&n);
for(i=0;i<n;i++)//purpose is to scan and output employee details
{
printf("-----------------------------------------");
printf("\n\tEnter Details of Employee-%d",i+1);
printf("\n-----------------------------------------");
printf("\nFirstName of Employee : ");
scanf("%s",e[c].firstname);
printf("\nSurName of Employee : ");
scanf("%s",e[c].surname);
printf("Employee-Id : ");
scanf("%d",&e[c].id);
printf("Status : ");
scanf("%d",&e[c].status);
printf("Age : ");
scanf("%d",&e[c].age);

}
}// END build FUNCTION

// Function to delete record at index i


void deleteIndex(int n)
{
for (int c = n; c < num - 1; c++) {
e[c].firstname == e[c + 1].firstname;
e[c].surname == e[c + 1].surname;
e[c].id = e[c + 1].id;

e[c].status = e[c + 1].status;


e[c].age = e[c + 1].age;
}
return;
}// END deleteIndex FUNCTION

// Function to delete record


void deleteRecord(int n)
{
printf("Enter the Employee ID ");
printf("to Delete Record");

int id;

scanf("%d",&e[c].id);
printf("Employee Details are now Deleted ");
for (int n = 0; n < num; n++) {
if (e[c].id == id) {
deleteIndex(n);
num--;
break;
}
}
}// END deleteRecord FUNCTION

int main()
{

printf("\n TERRIFIC FUTURE TECHNOLOGY FOUNDATION");


printf("\n providing the tech our world needs ");
printf("\n EMPLOYEE MANAGEMENT SYSTEM");
printf("\n =====================================");

printf("\n\n WELCOME USER! ");

printf("\n *How Many Employee Record Do You Want to


Add*/\n\nEnter Limit : ");
scanf("%d",&n);
for(i=0;i<n;i++)//purpose is to scan and output employee details
{
printf("-----------------------------------------");
printf("\n\tEnter Details of Employee-%d",i+1);
printf("\n-----------------------------------------");
printf("\nFirstName of Employee : ");
scanf("%s",e[c].firstname);
printf("\nSurName of Employee : ");
scanf("%s",e[c].surname);
printf("Employee-Id : ");
scanf("%d",&e[c].id);
printf("Status : ");
scanf("%d",&e[c].status);
printf("Age : ");
scanf("%d",&e[c].age);

}
while(1)//to output a menu for the user to select a choice
{
printf("-----------------------------------------\n");
printf("Available Options:\n\n");
printf("-----------------------------------------");
printf("\n 1:Search Employee by E-ID");
printf("\n 2:Add empRecords");
printf("\n 3:Delete Record ");
printf("\n 4:Exit");
printf("\n----------------------------------------\n");
printf("Enter Your Choice : ");
scanf("\n %d",&ch);
switch(ch)
{
case 1: emp_search(n);
break;
case 2: build(n);
break;
case 3: deleteRecord(n);
break;
case 4: exit(0);
}
}
{
return 0;
}

}
// END main FUNCTION
Test Plan

Variable Name Test Type Purpose of data Expected


Results
e[c].id integer
e[c].surname string To allow the The program
program to store stores the data
the surname of and asks for
an employee the next piece
of information
e[c].firstname string To allow the The program
program to store stores the data
the and asks for
first name of an the next piece
employee of information
e[c].status integer To allow the The program
program to store stores the data
the and asks for
status of an the next piece
employee of information
e[c].age integer To allow the The program
program to store stores the data
the and asks for
age of an the next piece
employee of information

You might also like