Glide
Member
- Joined
- Oct 13, 2003
- Messages
- 103
Question 22 E 2002 paper
2002 Paper here
Please rip it apart
2002 Paper here
Code:
BEGIN CostOfTickets(UserDest,NumSingle,NumReturn)
Set FoundDest as Boolean
Set TotalFare as Integer
Set Index as Integer
FoundDest = False
TotalFare = 0
Index = 1
WHILE destination(Index) < 101 AND FoundDest = False
IF Destination(Index).station = UserDest THEN
TotalFare = Destination(Index).Fullsingle * NumSingle
TotalFare = TotalFare + Destination(Index).FullReturn * NumReturn
FoundDest = True
END IF
Index = Index + 1
ENDWHILE
Display TotalFare
END CostOfTickets