Você está na página 1de 6

Pre Release Material

SOLVED (Pseudo Code & V.B Console Mode)

Summer 2017 | O Levels | Computer Science

In Preparation for the examination candidates should attempt the following practical
tasks by writing and testing a program or programs.

The Organizer of a senior citizens club has arranges outings for the members. For
each of these outings a coach is hired, meals at a restaurant are reserved and
tickets for the theater has booked. A program is required to work out the costs
and provide a printed list showing everyone on the outing.
Write and test a program for the club organizer.

Your program must include appropriate prompts for the entry of data.

Error message and other output need to be set out clearly.

All variables, constants and other identifiers must have meaningful names.

You will need to complete these three tasks. Each task must be fully tested.

Work out the total cost of the outing.


TASK 1
The organizer finds out how many senior citizens are interested in the outing. The program
for Task 1 works out the cost for the information.

Number of people Hire of couch Cost of a meal Cost of theater ticket


12 16 150 14.00 21.00
17 26 190 13.50 20.00
27 39 225 13.00 19.00

The minimum number of senior citizens needed for the outing to go ahead is 10; there
cannot be more than 36 senior citizens on the outing. A minimum of two carers go on the
outing. With an additional carer needed if more than 24 citizens go on the outing. Carers
do not have to pay anything for the outing. Workout the total cost per person for the senior
citizens.

Task 2
Record who is going on the outing and how much has been paid.

Using your results from Task 1, record the names of the people on the outing and the
amount they have paid; include the carers on the outing. If there are spare places on the
coach then extra people can be added; they are charged the same price as the other
citizens. Calculate the total amount of money collected. Print out the list of the people on
the outing.

Task 3
Identify the break-even point or profit that will be made on the outing.

Show whether the outing has made a profit or has broken even using the estimated cost
from the Task 1 and money collected from Task 2.
Solution (Pseudo Code)
Task 1

DECLARE citizen, people : integer

DECLARE total, cost_per_person : real

people 0, total 0, cost_per_person 0

OUTPUT (Enter in numbers how many senior citizens are interested in the outing)

INPUT citizen

WHILE (citizen < 10 OR citizen > 36)

OUTPUT (The minimum number of senior citizens needed for the outing to go
ahead is 10; there cannot be more than 36 senior citizens on the outing.)

OUTPUT (Enter in numbers how many senior citizens are interested in the
outing)

INPUT citizen

ENDWHILE

IF citizen > 24 THEN people citizen + 3

ELSE People citizen + 2

ENDIF

IF people >= 12 AND people <= 16 THEN

total 150 + (14.00 * people) + (21.00 * people)

ENDIF

IF people >= 17 AND people <= 26 THEN

total 190 + (13.50 * people) + (20.00 * people)

ENDIF
IF people >= 27 AND people <= 39 THEN

total 225 + (13.00 * people) + (19.00 * people)

ENDIF

cost_per_person total/citizen

TASK 2

DECLARE name(39) : string

DECLARE amount(39) : real

DECLARE seats, updated_people, c : integer

DECLARE extra_amount, total_amount, amount_paid : real

Seats 0, updated_people 0, extra_amount 0, total_amount 0, amount_paid 0

FOR c 1 to people

OUTPUT (Enter the name of person on the outing)

INPUT name(c)

OUTPUT (Enter the amount paid by the person)

INPUT amount(c)

amount_paid = amount_paid + amount(c)


NEXT

OUTPUT (If there are spare places on the coach then extra people can be added; they are
charged the same price as the other citizens.)

IF people >= 12 AND people <= 16 THEN

seats 16 people

ENDIF
IF people >= 17 AND people <= 26 THEN

seats 26 people

ENDIF

IF people >= 26 AND people <= 39 THEN

seats 39 people

ENDIF

extra_amount cost_per_person * seats

total_amount total + extra_amount

Updated_people people // Comment * : if there will be no extra people

IF seats >= 1 THEN

updated_people people + seat // Comment * : if there are extra people

OUTPUT(seats available for : , seats, person(s), Enter Name and Amount for
people will to go for outing)

FOR d c to updated_people //Comment *: appending the same arrays

OUTPUT (Enter the name of person on the outing)

INPUT name(d)

OUTPUT (Enter the amount paid by the person)

INPUT amount(d)

amount_paid = amount_paid + amount(d)


NEXT

ENDIF

FOR c 1 to updated_people

OUTPUT (The Citizens Name :, name(c) , & the amount submitted :, amount(c))

NEXT
Task 3

DECLARE profit : real

profit amount_paid total_amount

IF profit > 0 THEN OUTPUT ( The Profit Gained : , profit)

ELSE OUTPUT (The Break Even Point Value : ,total)

Você também pode gostar