Professional Documents
Culture Documents
Super 15marks Question
Super 15marks Question
START
DECLARE StaffName : ARRAY[1:5] OF STRING ={“Friend”, “Dennis”,
“Christopher”,”Khona”, “Mali”}
DECLARE StaffPhone : ARRAY[1:5] OF STRING = {“0112”,”0776”,”0989”,”0666”, “0555”}
DECLARE StaffOffice : ARRAY[1:5] OF STRING={“C14”, “C13”, “C12”, “C11”, “W2”}
DECLARE Count : INTEGER
Count0
REPEAT
FOR Count1 TO 4
IF StaffName(Count)>StaffName(Count+1) THEN
Temp1StaffName(Count)
Temp2StaffPhone(Count)
Temp3StaffOffice(Count)
StaffName(Count+1)Temp1
StaffPhone(Count+1)Temp2
StaffOffice(Count+1)Temp3
ENDIF
SwapTrue
NEXT Count
UNTIL Swap=False OR Upperbound>Lowerbound
FOR Count 1 TO 5
OUTPUT “Name: “, StaffName(Count)
OUTPUT “Phone: “, StaffPhone(Count)
OUTPUT “Office: “, StaffOffice(Count)
NEXT Count
END PROCEDURE
FOR Count1 TO 5
IF StaffName(Count)=SearchName THEN
FoundFlagTrue
FoundIndexCount
Next Count
IF FoundFlag=True THEN
OUTPUT “The name is in the array”
OUTPUT “Name: “, StaffName(FoundIndex)
OUTPUT “Phone: “, StaffPhone(FoundIndex)
OUTPUT “Office: “, StaffOffice(FoundIndex)
ELSE
OUTPUT “The name was not found in the arrays”
ENDIF
END PROCEDURE
12 You can become a member of the town guild if you meet all the following
requirements:
» aged between 18 and 65
» you have lived in the town for 20 years
or you have lived in the town for 5 years and both your parents still live in
the town
or one parent has died and the other parent still lives in the town
or you and a brother or a sister have lived in the town for 10 years
» you have half a million dollars in your bank account
» you have never been to prison
» at least two guild members support your application
» if five guild members support your application then you could be excused
one of the above requirements, apart from age
Write a program that allows you to input answers to questions to ensure that
you meet the requirements, issues a unique membership number if you do or
explains all the reasons for failure if you don’t meet the requirements. [15]