Você está na página 1de 27

Cape Computer

Science
School Based
Assessment

Name: Isaiah Canterbury


Candidate number: 090070-0157
School number: 090070-0157
Territory: Guyana

1
Teacher: Ms. Fontanelle
School Name: Presidents College

Content Page
~ ~ Acknowledgement___Pg 3

~ ~ Definition of Problem___Pg 4

~ ~ Narrative of Solution___Pg 5

~ ~ Narrative Algorithm___Pg 6-7

~ ~ Pseudocode___Pg 8-9

~ ~ Source Code___Pg 10-18

~ ~ Test Plan/Data___Pg 19-21

~~ Screenshots___Pg 22--26

~ ~ Bibliography___Pg 27

2
Acknowledgement

The researcher would to thank his Computer Science Teacher Ms. Fontanelle, for
providing ample guidance and care in aiding the complete of this project. Without
the various aid obtained from the researchers teacher and trusted colleagues this
project wouldnt have been able to be completed in the timely manner in which it
was.

Lastly the researcher gives his well-deserved thanks to God for keeping him focused
and on his path to completing the project and success.

3
Definition of Problem
(History/Specifics of organization the problem is being solved for):

~ President's College is a senior secondary school Presidents College is a senior


secondary school located in Golden Grove, East Coast Demerara, Guyana. This
institution opened in 1985 and was founded in by the late president of Guyana
Forbes Burnham. The contact number of the school is +592-255-3016. The school
offers many subjects, including Biology, Chemistry, Mathematics (Of different
levels), and English etc. The teachers currently utilize a manual system to generate
each class report and the students reports. In this system, the teacher of each
class utilizes a pen paper and a calculator to develop and produce or create a report
for the class and each student.

(The proposed solution to the problem in detail):

~ I believe teachers might find the current payroll-generating system somewhat


tedious and time-consuming as they often have to manually write up and calculate
employee salary by hand. Although this is not always the case, modern Technology
and its continued development can provide more efficient and faster ways to
perform these tasks. This could be of great aid to the accountants responsible for
the calculating and delivering of payrolls and results for the institutions employees.

4
Narrative of Solution
This narrative describes the main functions of the Mass Payroll Analyzer program.
As the program starts, the menu function containing all the program options will be
displayed. Following this, if the user enters their choice from the options given, the
menu function will automatically execute that operation. Whereby if an invalid
option is entered the program would pause and an error message will be displayed
along the screen, indicating to the user to enter back a valid one.
The option 1 in the menu function (Calculate an employees salary)
The Calculate and employees salary operation firstly carries out the
password functionVERFICATION, which prompts the user to enter the
correct password. If the invalid one is entered, an error message is then
displayed indicating the user to enter back the correct password. After the
password function a welcome message will appear showing some instructions
that should be followed, the CALCULATE function will then be displayed.
This prompts the user to enter the employees name, identification number,
the regular pay rate, the regular hours of work and the number of hours
worked. In addition, the overtime pay rate and the number of overtime
worked is also entered. After this, the program will then execute the INFO
function, which displays the pay cheque with the information entered and the
calculated payment for that employee.

The option 2 in the menu function(Help and More Information)


The Help and more Information operation or the RESTRICTED function will
display a screen showing some easy instructions on how to run the program
and also the creators contact information is given if any further assistance is
required. After this the user will be prompted to press a key to return back to
the option menu.

The option 3 in the menu function(End Program)


The End Program option or the ENDPROGRAM function will allow the user
the exit the program when all the operations are completed.

5
Narrative Algorithm
Welcome Screen Algorithm
Start
Print Welcome Screen
Pause the Screen
Stop
Program Boot up Algorithm
Start
Clear the screen
Initiate file streamer point
Stop
Menu Screen Algorithm
Start
Execute the program start up function
Display the Menu function
Read the option entered
If the choice entered proves to be valid, execute the function corresponds with the
option chosen.
If the choice entered is invalid, print a suitable message
Stop
Calculate an employee Salary Algorithm
Start
Execute the startup function
Prompt the user to enter the necessary password
If the user enters a choice password, print a suitable message
If the user enters the valid password, proceed with the execution of the program
Print the sub-menu function
If the user then enters a choice option, print a suitable message
If the choice is valid, proceed to execute the function that corresponds with the
users choice

6
Execute Pay roll calculating functions
Read the users choice
If the user enters an invalid choice, print a suitable message.
If the users choice is valid, print slip containing all the relevant payment
information
Stop
Help and More information Algorithm
Start
Print the logging in screen
Pause the Screen
Print the Help and More information Screen
Print the return operator
Read the choice
If the choice entered is invalid, print a suitable message
If the users choice is valid, return to the main menu
Stop
Exit to main menu sub function in Help and More information Algorithm
Start
Return to main menu
Exit Program Algorithm
Start
Execute the program start up function
Display the Exit screen
Stop

7
Pseudocode
WELCOME SCREEN FUNCTION
Begin
~~~Flash input Buffer
~~~Write the welcome screen
~~~Pause the screen
End
START UP FUNCTION
Begin
~~~Clear the screen
~~~Initiate the file stream pointer
End
MENU FUNCTION {OPTIONS}
Begin
~~~Write the necessary options
~~~Scan the input
~~~If input = 1
~~~Proceed to VERFICATION
~~~Else
~~~If input = 2
~~~Write the welcome screen to Help and more Information
~~~Proceed to RSTRICTED
~~~Else
~~~If input = 3
~~~Proceed to ENDPROGRAM
~~~Else
~~~Write the error screen
~~~Return to the options
Endif

8
VERFICATION FUNCTION
Begin
~~~Prompt the user to enter the password
~~~Scan for input
~~~If the password = 4002
~~~Clear the screen
~~~Write the welcome screen to the sub menu
~~~Proceed to CALCULATE
~~~Else
~~~Write the error screen
~~~Return to VERFICATION
Endif
RESTRICTED FUNCTION
Begin
~~~Write the welcome screen and necessary options
~~~Scan for input
~~~Calculate the regular salary without overtime
~~~Calculate the overtime pay
~~~Calculate the overtime pay
~~~Calculate the total net pay
~~~Write the pay cheque
~~~Return to ENDPROGRAM
End
ENDPRGRAM FUNCTION
Begin
~~~Clear the screen
~~~Write the thank you screen
~~~Pause the program
~~~Exit the program
End

9
SOURCE CODE
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include <time.h>
#include <windows.h>

#include <math.h>
#include <stdarg.h> /**ALL THE LIBRARY FUNCTIONS**/

int WELCOMESCREEN();
int OPTIONS( );
int RESTRICTED( );
int ENDPROGRAM( );
int INFO( );
int CALCULATE( );
int VERFICATION();
int RETURN();
char emploname[50];
char emplofirstname[25];
char emplolastname[25];
int IDnum;
int regr;
int regpay;
int regh;
int ovtr;
int ovth;
int regsaly;
int ovtpay;
int totalnetpay;

10
int options;
int totalhwk;
int ifelse;

int main( )
{
system ("color 05");
WELCOMESCREEN();
OPTIONS( );
}
int WELCOMESCREEN( ) /**WELCOME SCREEN FUNCTION**/
{
int selection;
printf("----------------------------------------------------------------------------\n");
printf("***************************************************\n");
printf("----------------------------------------------------------------------------\n");

printf("^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$\n");
printf("***************************************************\n");
printf("$-------- $$$/////*****************/////$$$ ----------------$\n");
printf("$*|*|*|*|*|*|*|*| WELCOME |*|*|*|*|*|*|*|$\n");
printf("$*|*|*|*|*|*|*|*| TO |*|*|*|*|*|*|*|$\n");
printf("$*|*|*|*|*|*|*|*| MASS |*|*|*|*|*|*|*|$\n");
printf("$*|*|*|*|*|*|*|*| PAYROLL |*|*|*|*|*|*|*|$\n");
printf("$*|*|*|*|*|*|*|*| ANALYZER |*|*|*|*|*|*|*|$\n");
printf("$-------- $$$/////*****************/////$$$ ----------------$\n");

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

printf("^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$\n");
printf("----------------------------------------------------------------------------\n");
printf("***************************************************\n");
printf("----------------------------------------------------------------------------\n");
printf(" \n");

system("PAUSE");
system("CLS");

11
}
int OPTIONS( )
{
int choice;

printf("*MAKE A SLECTION ON THE OPTIONS BELOW\n");


printf(" \n");
printf("1/Calculate an employee's salary\n");
printf(" \n");
printf("2/Help and more information\n");
printf(" \n");
printf("3/End Program\n");
printf(" \n");
printf("Kindly make your selection");
printf(" \n");
scanf("%d", & choice);

if(choice==1)
{
int VERFICATION(); /*PROCEEDS TO ENTERING THE PASSWORD TO START THE PROGRAM*/
system("CLS");
system("color 5B");
int passwd;
CALCULATE( );
printf("Enter the passwd\n");
scanf("%d",&passwd);
if(passwd==4002)
ifelse; return(passwd);
}
else
if(choice==2)
{
system("color 5F");
printf("P..\n");
system("CLS");
printf("PR.. \n");
system("CLS");

12
printf("PROC\n");
system("CLS");
printf("PROCE\n");
system("CLS");
printf("PROCESS\n");
system("CLS");
printf("PROCESSI..\n");
system("CLS");
printf("PROCESSING\n");
printf(" \n");
printf("<><><><><><><><><><><><><><><><><><>\n");
printf(" <><><><><><><><><> \n");
printf("Thank you for logging in user\n");
printf(" <><><><><><><><><><><> \n");
printf("<><><><><><><><><><><><><><><><><><>\n");
printf(" \n");
system("PAUSE");
return RESTRICTED();
system("PAUSE");
}
else
if(choice==3)
{
ENDPROGRAM( );
system("PAUSE");
system("CLS");
}
else
{
system("color A0");

system("CLS"); /*WHEN AN INVALID OPTION IS ENTERED, THIS ERROR SCREEN


APPEARS*/
printf(" \n");
printf(" ~~~ERROR DETECTED~~~\n");
printf("PLEASE ENTER A GENUINE OPTION!!\n");
printf(" <><><><><><><><><><><><><><>\n");

13
printf(" \n");
system("PAUSE");
system("CLS");
OPTIONS(); /*RETURNS TO THE MENU FUNCTIONS*/
}
}
int RESTRICTED( )//*IF BY ANY CHANCE THE USER DOES NOT KNOW THE PASSWORD, THEN
THEY CAN CHECK THE HELP AND MORE INFORMATION*//
{
system("CLS");
system("color 5E");
int decision;
printf(" <><><><><><><><><><><><><><><><> \n");
printf("****WELCOME USER TO HELP AND MORE INFORMATION****\n");
printf(" ><><><><><><><><><><><><><>< \n");
printf(" ~~~~~~~~ MASS PAYROLL ANALYZER ~~~~~~~ \n");
printf(" \n");
printf("INSTRUCTION:\n");
printf("KINDLY ENTER THE NUMBER NEXT TO YOUR CHOICE AND\n");
printf("PRESS THE ENTER KEY TO CONTINUE WITH THE PROGRAM\n");
printf("IT IS VERY SIMPLE AND LESS TIME CONSUMING!!!\n");
printf(" ><<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>< \n");
printf(" ****~~~~****~~~~****~~~~****\n");
printf(" n");
printf("FOR MORE INFORMATION\n");
printf("PROGRAMMER: ISAIAH CANTERBURY\n");

printf("EMAIL: isaiahcanterbury@yahoo.com\n");
printf("TELE: 255-3004\n");
printf("DATE CREATED: January 29th, 2017\n");
printf(" \n");
printf("3/Exit to the main menu\n");
printf(" n");
scanf("%d",&decision);
if(decision==3);
{
system("CLS");

14
int OPTION(); //~~RETURNS TO THE MAIN FUNCTIONS~~//
}

}
int VERIFICATION( ) //~~~VERFICATION OF PASSWORD,IF THE PASSWORD IS CORRECT IT
WILL PROCEED TO THE PROGRAM~~~//
{
system("CLS");
system("color 5B");
int passwd;
CALCULATE( );
printf("Enter the passwd\n");
scanf("%d",&passwd);
if(passwd==4002)
ifelse; return(passwd);
{

system("PAUSE"); /*INSTRUCTION TO START THE PROGRAM*/


system("CLS");
printf("<><><><><><><><><><><><><><><><>\n");
printf(" ~~WELCOME USER~~ \n");
printf(" ~~~~~ ~~~~\n");
printf("Please follow the steps to calculate the employee's monthly payments\n");
printf("This program serves only to formulate the correct payments for an employee\n") ;
printf("<><><><><><<<<<<<<<<<<<<<<><><><><><><>\n");
printf(" n");
system("color 9D");
system("PAUSE");
system("CLS");
CALCULATE( );
}
ifelse;
{
system("PAUSE");
system("CLS");
printf("<><><><<<><><><><><><><><><><><><<<><><>\n");

15
printf(" ~~~ ERROR!!! ~~~\n");
printf("~~~INVALID PASSWORD!!! TRY AGAIN!!! ~~~ \n");
printf(" <><><<><><><<><><<><><><><<>\n");
printf(" \n");
system("color A0");
system("PAUSE");
system("CLS");
VERFICATION();
}
system("PAUSE");
}
int CALCULATE( ) /*CALCULATE THE EMPLOYEE'S CORRECT PAYMENT FOR THE WEEK*/
{
system("CLS");
system("color DF");
printf(" Please enter the Employee's Name <<example:_Isaiah_Canterbur>>\n");
scanf("%d",&IDnum);
printf("Please enter the Regular hours of work \n");
scanf("%d",&regr);
printf("Please enter the Regular Pay Rate \n");
scanf("%d",&regr);
printf("Please enter the Number of hours the employee worked \n");
scanf("%d",&totalhwk);
printf("Please enter the Number of Overtime Hours the Employee had worked \n");
scanf("%d",&ovth);
printf("Please enter the Overtime Pay Rate \n");
scanf("%d",&ovtr);
printf(" \n");
regsaly = (regh*regr);
totalhwk = (regh+ovth);
ovtpay = (ovth*ovtr);
totalnetpay = (ovtpay+regsaly);
system("PAUSE");
system("CLS");
return INFO( ); //~GOES TO THE INFO FUNCTION TO DISPLAY THE INFORMATION AFTER
CALCULATING~/

16
}
int INFO( ) //~THIS DISPLAYS THE PAY ROLLING INFORMATION FOR A PARTICULAR
EMPLOYEE~//
{
system("CLS");
int INFO;
system("color 5F");
printf(" \n");
printf("<><<<<~~~~PAY CHEQUE~~~~>>>><>\n");

printf("~~~~~~~~~********<<<<<<<<<<<>>>>>>>>>>>>********~~~~~~~~\n"
);
printf("*********************************************\n");
printf(" Monthly Pay Cheque For %s\n",emploname);
printf("~~~~~~~~~ ~~~~~~~~~~~\n");
printf(" ------------------------------------------------------------ \n");
printf(" -------*************************************---- \n");
printf("Identification Number *** #%d\n",IDnum);
printf("Regular Pay Rate *** #%d\n",regr);
printf("The Number of Hours worked *** #%d\n",totalhwk);
printf("Regular Salary Excluding Overtime *** #%d\n",regsaly);
printf("Overtime Pay Rate *** #%d\n",ovtr);
printf("The Number of Overtime Hours worked *** #%d\n",ovth);
printf("Overtime Pay *** #%d\n",ovtpay);
printf(" \n");
printf(" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n");
printf("*******~~~~~~***********************~~~~~~~*******\n");
printf("The Total Net Salary ~~~~~$%d\n",totalnetpay);
printf("~~~~~~~<<<<<<<<<<<<<<<<>>>>>>>>>>~~~~~~~\n");
printf(" \n");
printf("PAUSE");
printf("CLS");
return ENDPROGRAM( ); /*PROCEEDS TO THE ENDPROGRAM FUNCTION TO TERMINATE THE
PROGRAM*/
}

int ENDPROGRAM( ) /*THIS TERMINTATES THE PROGRAM WHEN PAYROLLING IS FINISHED*/


{

17
system("CLS");
system("color 9F");
printf(" \n");
printf(" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
printf(" ________________---------------------------------________________\n");

printf("<<<<<<<<<<<<<>>>>>>>>>>>>>><<<<<>>>>>>>>>>>>>>>>>>\n
");
printf(" -----------_______--------");
printf("************************************************************\n");
printf("<<<>>>THANK YOU FOR USING MASS PAYROLL ANALYZER<<<>>>\n");
printf("<<<<<-----------------ENJOY YOUR SPENDINGS $$$$$$ ------------'>>>>>>>>");

printf("<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>><<<<<<<>>>>>>>>>>
>>>>>>>\n");
printf(" ----------------------**********************-----------------***************\n");
printf("********************--------------
<<<<<<<<<<<<<<<<<>>>>>>>>>>>>****\n");
system("PAUSE");
system("CLS");
system("EXIT");
}

18
Test Plan/Data
Description (1):
To test the main function (OPTIONS function)
Steps
~ In the main menu enter 1 as the choice to calculate an employees
payment.
~ Enter 2 as your choice in the main menu to display the Help and
Information screen.
~ Enter 3 in the main menu to exit or terminate the program.
Expected Results
~The program should go to the VERFICATION screen/function.
~The program should go to the RESTRICTION function.
~The program should display the thank you and good bye screen, followed
by the terminating of the program.
All the expected results were attained.

Description (2):
To Test the VERIFICATION function.
Steps
~Enter 1 to select the option 1 in the main menu.
~ Enter 4002 as the password for the program to continue.
~Enter 45678 as the password for the program to continue.
Expected Results
~The program should prompt for the password to continue with the program.
~The program should continue to the CALCULATE function.
~The program should print the invalid password entered.
All the expected results were attained.

Description (3):
To test the CALCULATE function.
Steps
~Enter the employees name.
~Enter the employees identification number.

19
~Enter the regular hours of work.
~Enter the regular pay rate.
~Enter the number of hours the employee worked.
~Enter the number of overtime hours the employee had worked.
~Enter the overtime pay rate.
~Display the pay cheque from the INFO function.
Expected Results
~The CALCULATE function should begin properly.
~Them employees name should be entered.
~The employees identification number should be entered.
~The regular hours of work should be entered.
~The regular pay rate should be entered.
~The number of hours the employee worked should be entered.
~The number of overtime hours the employee worked should be entered.
~The overtime pay rate should entered.
~The pay cheque should be printed out on the INFO function screen.
All expected results were attained.

Description (4):
To test the RESTRICTED function
Steps
~Press any key to continue with the program.
~Display the Help and More Information screen.
~Press 3 to return to main menu.
Expected Results
~The RESTRICTED function should start successfully.
~The program should display the Help and Information screen.
~The program should return back to the main menu screen.
All the expected results were attained.

Description (5):
To test the ENDPROGRAM function.
Steps
20
~In the main menu enter 3 as the choice to continue.
Expected Results
~The ENDPROGRAM function should start successfully.
~The thank you and good bye screen should be printed.
~The program should end.
All the expected results were attained.

Screenshots

21
22
23
24
25
26
Bibliography
Books
~Jase Omeileo West, 2012, Cape Computer Science Unit 1
~Noel Kalicharan, 2005, C Programming- A Beginners Course

Internet Sources
~http://www.wikipedia.org
~https://www.scribd.com/
~https://www.capecomputerscience.com/

27

Você também pode gostar