Sunteți pe pagina 1din 3

PROGRAM SBA(input, output); {This accepts names and payments for an undefined am

ount of people. Each person is placed in a section


based on the amount of money paid. The program also
counts the number of persons in each section and the
total collected for the section as well as the grand
totals for all.}
USES
crt;
CONST
price : array [1..5] of real= (160,220,280,350,425); {The array 'pri
ce' holds the five costs for the sections}
secN : array [1..6] of string = ('One','Two','Three','Four','Five',
'N/A'); {This holds the fives names for each section}
VAR
countR : array [1..5] of integer;
countC : array [1..5] of real;
cname, sec : string[15];{used to identify and keep the section of an entr
y}
wloop, rtol : integer;
cash, ctol : real;
con : char;
gt, go : byte;
BEGIN
{First Screen - Welcomes the user to the program giving the options to proc
eed to the entry screen or to the exit screen}
gotoxy(27,3); writeln('School Based Assessment for');
gotoxy(39,4); writeln('CXC');
gotoxy(35,5); writeln('Presented to');
gotoxy(23,6); writeln('Mannings School Business Department');
gotoxy(20,7); writeln('In Partial Fulfillment of the Certification');
gotoxy(30,8); writeln('In Information Technology');
gotoxy(34,9); writeln('(Programming)');
gotoxy(1,15); writeln('NAME: Shevon Williams');
gotoxy(1,16); writeln('SUBJECT: Information Technology');
gotoxy(1,17); writeln('TERRITORY: Jamaica');
gotoxy(1,18); writeln('CENTER #: 100068');
gotoxy(1,19); writeln('TEACHER: Mr. Hill');
gotoxy(21,12);writeln('Would you like to initiate program? Y/N');
gotoxy(60,12); con:= upcase(readkey);
IF (con = 'Y') or (con = 'y') THEN
begin
clrscr;
writeln('Please enter Masqueraders names and the amount paid');
writeln('The following are prices and their related sections : ');
writeln('Section1 - $',price[1]:6:2,' Section2 - $',price[2]:6:2,'
Section3 - $',price[3]:6:2);
writeln('Section4 - $',price[4]:6:2,' Section5 - $',price[5]:6:2);
gotoxy(25,6); write('Would you like to continue? Y/N');
gotoxy(57,6); con := upcase(readkey);
gt := 12;
{Loop which allows the user to add information for multiple entries}
WHILE (con = 'Y') or (con = 'y') DO
begin
sec:= secN[6];
{This section reads the name and payment of each entry.}
gotoxy(1,9); writeln('==========================================
======================================');
gotoxy(1,10); writeln('Masqueraders');
gotoxy(35,10); writeln('Amount Paid');
gotoxy(60,10); writeln('Section');
gotoxy(1,11); writeln('=========================================
=======================================');
gotoxy(1,gt); readln(cname);
gotoxy(35,gt); readln(cash);
{This section makes a list of entries made.}
FOR wloop := 1 TO 5 DO
begin
{identifies section of the masquerader by checking the
payment made by the user against those
stored for each section within the program. And adds co
unt to person counter.}
If cash = price[wloop] then
begin
countR[wloop]:= countR[wloop] + 1; {increase
s the number of persons in a section}
countC[wloop]:= countC[wloop] + cash; {increase
s the total for each section}
sec:= secN[wloop];
end;
end;
gotoxy(60,gt); writeln(sec);
{Gives the user option of adding another entry or exiting to
the Summary}
gotoxy(25,6); write('Would you like to continue? Y/N ');
gotoxy(24,7); write('Press "Enter Key" to show summary');
gotoxy(57,6); con := upcase(readkey);
gt:=gt+1;
end;
{This screen shows the summary of total collected in the section a
nd the number of persons in the section.}
clrscr;
gotoxy(1,2); writeln('============================================
====================================');
gotoxy(1,3); writeln('============================================
====================================');
gotoxy(1,4); writeln('Section');
gotoxy(30,4); writeln('Persons Registered');
gotoxy(65,4); writeln('Amount Paid');
gotoxy(1,5); writeln('============================================
====================================');
go := 8;
FOR wloop:= 1 TO 5 DO
begin
gotoxy(1,go); writeln(secN[wloop]);
gotoxy(38,go); writeln(countR[wloop]);
gotoxy(70,go); writeln(countC[wloop]:6:2);
go := go + 2;
end;
rtol := countR[1] + countR[2] + countR[3] + countR[4] + countR
[5]; {Finds the total entries registered}
ctol := countC[1] + countC[2] + countC[3] + countC[4] + countC
[5]; {Finds the total amount paid}
{This section shows total people registered and the total fund
s collected.}
go := go + 1;
gotoxy(1,go);writeln('========================================
=======================================');
go := go + 1;
gotoxy(1,go); writeln('Total');
gotoxy(38,go); writeln(rtol);
gotoxy(67,go); writeln('$ ',ctol:6:2);
writeln('=====================================================
==========================');
gotoxy(24,23); writeln('You have just ended use of program');
gotoxy(25,24); writeln('Thank you for your participation');
gotoxy(29,25); writeln('Press any key to exit...');
end;
IF (con = 'N') or (con = 'n') THEN
begin
{This is the exit screen which appears if the user chooses to exit fro
m the program}
clrscr;
gotoxy(24,13); writeln('You have just ended use of program');
gotoxy(25,14); writeln('Thank you for your participation');
gotoxy(29,16); writeln('Press any key to exit...');
end;
readkey;
END.

S-ar putea să vă placă și