You are on page 1of 23

IT Programming

SBA
May/June (2011)
rs
I
I
I
Table
of Contents
Contents
Page
Statement of the Problem
(2)
Assumptions and Limitations
(3)
List of Variables
(4)
Flowchart
(5)
Trace Table
(12)
Program
Listing
(13)
Test Data
(17)
Results
(18)
Statement of the Problem
The program accepts thirty students who completed the Common Entrance Examination,
stores; their first name, last name, primary school, identification number, score and two
secondary school choices. It verifies whether a score Is correct or not and assigns each
student Into a secondary school depending on their score and the schools pass mark It
counts the number of students who are assigned to each school It stores each childs name
& IDNO, In the secondary school list for which he passed. If a student does not pass for any
school, it prints their result as, Unassigned. After, it calculates and prints the avenge or
national mean. Finally, it prints the school lists and the number of students assigned to each
school.
(2)
Assumptions and Limitations
Limitations
>
The program does not cater for the first and second choice with the same character.
> The program will not detect wrong identification numbers. Furthermore, the identification
numbers were not checked for correct format; even copies can be entered with error.
Assumptions
The program assumes that no student gets a score of: 0 and 100.
The program assumes that each Secondary School can hold up to 30 students.
The program assumes that choices are entered in upper case only and does not specifically cater for choices in lower case.
{
3
}
List of Variables
Fname: holds the student first name
Iname: holds the student last name
Pschool: holds the student primary school
IDNO: holds the student identification number
Score: holds the student score percentage
Fchoice: holds the student first secondary school choice
Scholce: holds the student second secondary school choice
Validscore: determines whether a score Is valid or not
ValldFc: determines whether the first choice Is valid or not
ValldSc: determines whether the second choice Is valid or not
QCjlst: stores the first name, last name and Identification number of all students assigned to
Queens College.
SVHjIst: stores the first name, last name and Identification number of all students assigned to
Southern Valley High
HVJI5t: stores the first name, last name and identification number of all students assigned to
Habour View
QCount: counts and holds the number of students who passed for Queens College
SVH_Count: counts and holds the number of students who passed for Southern Valley High
HV_Count: counts and holds the number of students who passed for Habour View
Student: identifies a student by number (used with a For loop as a counter variable).
TScore: holds the total score (all scores of the students combined)
Avg: holds the average score (the total score divided by the total number ofstudents)
44)
Flowchart
QCCount E- 0
SVH Count 0
HVCount 4- 0
TSeore 4- 0
Student 6- 1)
hi
Print Enter First Name. Last Name, Primary
Read Fname, Lname, Psehool,
(S 1
23
L
I
No
No
Print Fname. Enarne. Pschool. Score
Print Unassigned
Print Fnarne, Lname, Pschool,
Print Queens CoIleg&
QC Iist[QC Count]
l1)NtO
F name

Ename
{
7
)
Print Fname, Lname, Psd
Print Southern Valley Hi
SVF[ iist[S Vii Count]
IDNO
Fname
Ename
{8)
Print Fnarne. Lname. Pschool. Score
Print Harbour View
HVlist[HVCountJ E
IDNO
+
Fnarne
-1-
Lname
/
//
/
4
(
N
9
mt QC Count. passed thr
Queens College!
(10
}
Print SW-I Count. passed for
Southern Valle High!
111
J..
Test Data
First Name Last Name IDNO Primary School Score % FC
SC Result
iohnGabel GiOl AngHcanPrnarj 7T3
QH
Pass
Kain Godspell GKO2 Anglican Primary 84.6
0 S Pass
Laura Smith
SLO3 Angcan Primary
592 S1H
FaiIj
Andrea WiHiams WAO4 Anglican Primary
60.8 S
H
Pass
Anita
Paul PAOS Anglican Primary
89.2
0 S Pass
-----r-----
Lucky
Acer_- ALO6 Anglican Pmary
S Pass
Eiedoya Civeile CEO7 Anglican Primary
S Pass
/
11
ii
/7
//
T
r
a
c
e
T
a
b
l
e
S
t
u
d
e
n
t
I
D
N
O
f
n
a
m
e
I
J
o
h
n
2
6
K
0
2
-
c
3
S
L
O
3
L
a
u
r
a
A
n
d
r
e
a
S
P
A
0
,
A
t
a
&
A
L
6
L
u
c
k
y
7
-
C
E
0
7
-
H
e
d
o
y
a
T
S
c
o
r
e
A
v
g
P
r
i
n
t

0 7
7
.
3
j
g
T
f
i
*
t
-

-
H
2
8
1
.
9

3
7
1
1
_
L
H
4
5
7
j

5
0
8
0
Q
C
=
4
S
V
H
=
0
7
2
.
6
H
V
=
2

-
r

7
2
.
6
-

{
L
I
I
n
a
m
e
S
c
o
r
e
F
C
7
r
r
9
n
e
L
7
7
.
3
9
L
1
_
z
6
_
1S
r
n
t
h
5
9
.
2
S
Z
L
W
f
f
l
i
a
m
s
S

5
-
-

A
c
e
r
C
i
v
e
h
e
5
2
3
/
Q

-
-
S
C
H
S H H S S
S
c
h
o
o

A
s
s
i
g
n
e
d
Q
u
e
e
n
s
C
o
H
e
g
e
Q
u
e
e
n
s
_
C
o
H
e
g
e
H
a
r
b
o
u
r
V
i
e
w
H
a
r
b
o
u
r
V
i
e
w
Q
u
e
e
n
s
C
o
H
e
g
e
Q
u
e
e
n
s
C
o
H
e
g
e
-
-
-

S
U
n
a
s
s
i
g
n
e
d
Q
C
C
o
u
n
t
L
S
V
H
C
o
u
n
t
H
V
_
C
o
u
n
t
0
0
1
0
0
-
-
-
.
-
1
-
-
-
-
-
-
-
2
0
2
3
I
0
2
-
-
-
4
0
2
T
1
r
-
-
-
-
.
-

-
Q
C
=
Q
u
e
e
n
s
C
o
l
l
e
g
e
S
V
H
=
S
o
u
t
h
e
n
V
a
l
l
e
y
H
i
g
h
H
V
H
a
r
b
o
u
r
V
i
e
w
/
Program Listing
Program CESchoolAssigned;
{This program uses the scores and the two choices of students who have completed the Common
Entrance Examination to assign each student to a secondary school. It also prints the average score
and the three secondary school lists.)
Uses WinCrt;
Va r
FnameLnamePschoolIDNO:strin
Fchoce Schoice char
t Validscore,ValidFc,ValidSc:string;
QCJist: array[L.30] of string;
SVHjist: array[1..301 of string;
z
HVJist: srray[1..30] ofstiing;
//
Student,QCCount,SVHCountHVCourit:integi;
/
Score,Avg,TScore:real;
/1
Begin
/
{lmtmll7atlonsl
QCCount:= 0;
/
SVHCount:= 0; TScore:=0;
\
/ [IV Count:=
0;
.
For Student:= 1 to 30 do \
\\
/
(Input of student data)
/
Begin
writein;
writeln(Enter The First Name:);
readin(Fname);
writelnEnter The Last Name:);
readln(Lname);
writeln[Enter The IDNO:);
readln(TDNO);
writeln(Enter The Primary School:]:
reaciln(Pschool);
1_..-Jtepeat
writeln(Enter The Score:);
readin(Score):
L5
J
if (Score <=0) or (Score >lOO) Then
Begin
Validscore: No;
Writein (invalid Score!):
End
Else
Valldscore:=
Yes;
iJntjl Validscore = Yes;
FScore:= TScore +
Score;
Repeat
Writeln (Enter The First Choice and Second Choke:);
readin (Fchoice); readln (Schoice);
/
Case Fcholce of
Q,S: ValldFc:= Yes;

F
Else
/
Begin
\
ValldFc:=\No;
/
Writein
fiKvaiJO First Chrncefl;
End
End;
Case Schoice of
Sll VaiidSc= Yes,
Else
Begin
ValldSc:=No;
Writein (invalid Second Choice!);
End
E id;
in,
fl
aliiFYc , itt (i zIS.rYvc)
if(S or = 5) and Fth 1w
- 2)
Then

H
1---
Else
if (Score >= 55) and
Begin
Writetn(Fname,
1,1
I, Score);
Writeln(Congratuiations, t6Are Accepted To Harbour View!);
HVCount= HV_Count +1;
HVjist[HV...Count] IDNO
.
Fname
+ +
Lname;
END
Else
Writein (Unassigned);
End;
(Avenge calculations and printing of secondary school lists.)
Write!n;
Avg:= TScore/30;
Writein (Avenge
rn,
,Avg:2:l);
Writein;
t
For Student= 1 to QCCount do
Writeln (QCjist [Student]);
LLW
tA1tLj
.
-fl
Wrlteln(QC_Count,, Students Have Been Assigned To Queens Collegel);
wetj
(15)
-.
or an-aj
Begin
Writeln(Fname, ,Lname, ,Pschooi, Score);
/
Writeln (Congratulations, You Are Accepted To Queens College!I);
QC_Count:= QC_Count +1;
QCjlst(QCCountJ
rn
IDNO +
+ Fname . + L,name;
End
Else
r* 2
if (Score
>=
62) And ((Fcboice = 5) or (Schoice = 5)) Then

Begin
\
e1[
Wrltein(Pname ,Lname, ,Pschool, Score);
1
Wrftein (Congratulations, You Are Accepted To Southern Va!iey$igh!)
SVH.,Count:= SVHCount +1;
SVHjist[SVHCount]:=
IDNO + + Fname + +
Lname;
End
-J
I
/
I
Writein;
For Student:= 1 to SVH_Count do
Writein (SVHjist [Studentj);
Writein;
Writein (SVH_Count Students Have Been Assigned To Southern Valley High!);
Wrftein;
For Student:= 1 to HV_Count do
Writein (HVjist (Studentfl;
Writein;
Writein (HV..Count, Students Have Been
End.
In&Q -
{16)
-a
Results
p
Enter The First Name:
John
Enter The East Name:
Gabriel
Enter The IDNO:
C J 01
Enter The Primary School:
crnglican Primary
Enter The Score:
77 3
Enter The First Choice and Second Choice:
0
H
Congratulations, You Are Accepted To Queens College?
Enter The First Name:
Rain
Enter The Last Name:
Godspell
I
Enter The WHO:
GKO2
Enter The Primary School:
Anglican Primary_
-
Enter The Score:
\
Enter The First Choice and Second\Chice:
0
S
Congratulations, You Are Accepted To Queens College?
Enter The First Name:
Laura
Enter The Last Name:
Smith
Enter The WHO:
SE 03
Enter The Primary School:
Anglican Primary
Enter The Score:
59
Enter The First Choice and Second Choice:
H
Conqratulations, You Are Accepted To Harbour Uiew?
U(...
/Zt7
-
(
is)
Enter The First Name:
Andrea
Enter The Last Name:
Williams
Enter The EDNA:
Wf1114
Enter The Primary School:
Anglican Primary
Enter The Score:
608
Enter The First Choice and Second Choice:
H
Congratulations, You Are Accepted To Harbour Uiew?
Enter The First Name:
Anitta
Enter The Last Name:
Paul
Enter The EDNA:
PAO5
Enter The Primary School:
Anglican Primary
/
j
Enter The Score:
N
89.2
N
Enter the First Choice and\Second hoice: \
0
S
Congratulations, You Are Accepted/Ta Queens College?
\\J
Enter The First Name:
Lucky
Enter The Last Name:
Acer
Enter The EDNA:
AL 06
Enter The Primary School:
Anglican Primary
Enter The Score:
1 0-1
Inualid Score?
Enter The Score:
84.6
Enter The First Choice and Second Choice:
0
0
Invalid Second Choice?
Enter The First Choice and Second Choice:
0
S
Congratulations, You Are Accepted To Queens College?
{
IS)
)
Enter The First Kane:
Eledopa
Enter The Last Name:
Civelle
Enter The WHO:
CEll
Enter The Primary School:
Anglican Primary
Enter The Score:
52.3
Enter The First Choice
H
0
-(20)--
and Second Choice:
Inualid First Choice?
Inualid Second Choice?
Enter The First Choice and Second Choice:
U
S
Unassigned
Auerage 72.6
GJIt John Gabriel
01(02 Ham Godspell
PAS Anitta Paul
ALSO Lucky Acer
Stu nts Haue Been Assigned To Queens College?
Students Ha en Assigned To Southern Ualley High?
15L13 Laura S.th
,jWASb Andrea Williane
2 Students Haue Been Assigned To Harbour Uiew?
CSEC Information Technology
SBA Exemplar June 2011
Comments
m1mlementation
The candidate provided evidence of program code and program output. Based on the
program output, it was clear that the program had compiled successfully and the candidate
inputted data to test every condition and constraint.
The candidate used more than three variable types and the appropriate variables were
initiated.
The program was well-sequenced.
The candidate used the various forms of the IF statement. The candidate also included a
CASE statement, even though that was not required as stated in the syllabus.
Different types of looping structures were used. Some were used to inputloutput data into
arrays.
The program was not well documented. The candidate had a statement of the problem.
however, it did not include the authors name. date created, and very little internal
documentation throughout the program.
The program code was well indented.
The program was very user-friendly. The instructions given were easy to follow.
In the program implementation section, this candidate would have received 14 out of the
possible 15 marks.
lorithn
This candidates problem solving and programming sample was veil presented. The
candidate submitted the sample with a cover page and table of contents with page numbers.
The candidate provided a detailed problem statement which also included limitations and
assumptions made by the programmer.
The candidate printed a variable listing with descriptions. Missing was the intended data
types (character, numeric)
The flow chart v as well presented. It had selection structures but no looping structure a as
presented.
For the algorithm section, this candidate would have received 9 out of the possible 10 marks.
CSEC Information Technology
SBA Exemplar June 2011
Trace Table
The attempt of tracing the flowchart by the candidate was good. A few variable names were
missing and the selection structures were not represented in the trace table to show logic
flow, A column for each selection structure should have been present. This would have
made the trace table more robust. The candidate would have received 3 out of the possible 5
marks.

You might also like