Professional Documents
Culture Documents
The organizer of a senior citizens club arranges outings for the members. For each of these outings a
coach is hired, meals at a restaurant are reserved and tickets for the theatre are booked. A program is
required to work out the costs and provide a printed list showing everyone on the outing.
The organizer finds out how many senior citizens would be interested in the outing. The program for
TASK 1 works out the cost from this information.
Number of people Hire of coach ($) Cost of a meal ($) Cost of a theatre ticket ($)
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 must go on the outing, with an
additional carer needed if more than 24 senior citizens go on the outing. Carers do not have to pay
anything for the outing. Work out the total cost and the 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 senior citizens. Calculate the total amount of
money collected. Print out a 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 TASK 1
and the money collected from TASK 2.
2|Page Pre-Release Material (May/Jun17)
Task 1
Task 2
Task 3
Variables declaration
Approach to Solution
Like every other algorithm, there can be many approaches to solve these tasks depending upon the
understanding of person. We are listing down the key points that reflect our understanding and well
solve these tasks according to following assumptions.
In Task1, the cost of meal and theatre ticket are considered per person while the cost of coach is
considered accumulated.
In Task1, the total cost will be calculated by taking both senior citizens and carers into
consideration while per person cost will be divided among senior citizens only as listed in the
question (i.e. carers do not have to pay anything)
In Task2, a single array will be used to store the names of all people going on outing (i.e. both
senior citizens and carers)
In Task2, input of amount will not be taken because it has already been calculated in Task1 and
the question clearly says to use it from Task1. So it will be redundant to take it as an input
despite knowing that the cost per person is the same as Task1.
Color Codes
The pseudocode uses different colors to represent keywords for easier understanding. These color
codes are listed below.
Task 1
In this task we take input the total number of senior citizens going on the outing. Validation will be
performed using REPEAT-UNTIL to check that the input lies between 10 and 36.
IF statement will be used to calculate the carers needed to go along with the senior citizens which will
give us the total people that are going on the outing.
The total cost will be calculated according to the table given in question (see diagram below for
explanation)
Hire of coach depends upon Cost of meal and ticket are per person
the number of people. It will basis; meaning if 13 people are going
be included only once for all then cost of both meal and ticket will be
people that are going multiplied by 13
Cost per person will be calculated by dividing the total cost among senior citizens only (since carers do
not pay anything so their cost will be bear by senior citizens.)
For example:
If 12 senior citizens are going on the outing, then they will be accompanied by 2 carers. The total cost
will be calculated according to the 1st row/block of table.
However the cost per person will be calculated from the number of senior citizens only because carers
are not paying anything. So,
Task 2
In this task, well first calculate remaining seats in coach. Since the coach capacity (remaining seats)
depends upon the people that are going, this can be easily calculated by subtracting total people (from
Task1) by the maximum people that can be accommodated in the coach (given in table). This will be
done using IF statements.
An easy way to understand this is to assume that each row of the table corresponds to a different coach.
Coach 1
Coach 2
Coach 3
Thus is, if total people in Task 1 are 19 (including carers) then the remaining seats should be
26 19 = 7; because we know that only Coach 2 can accommodate greater than 17 people and its
maximum capacity is 26.
Once we get the count of remaining seats in coach, we will then take input the number of extra people
that can be included in outing and validate it using REPEAT-UNTIL loop. (An important thing to
remember is that these extra people will always be the senior citizens and not the carers because we
already calculated the carers in Task 1 and they will not change even when we add extra senior citizens)
A recalculation of total people is also needed because extra people may be added from the above step.
At the end we will use a FOR loop to fill the array with the names of people going on the outing and
calculate the total cost by simply multiplying the newly calculated total people by per person cost (from
Task 1)
Task 3
In this task we will calculate the difference of cost from Task1 and Task 2. If the difference is greater
than 0 then a message of Profit (or any other appropriate message) should be printed otherwise
Broken even should be printed.
7|Page Pre-Release Material (May/Jun17)
REPEAT
PRINT Enter the senior citizens going on outing?
INPUT scitizen
IF scitizen < mincitizen THEN
PRINT At least 10 senior citizens should go on outing
ELSE IF scitizen > maxcitizen THEN
PRINT Maximum of 36 senior citizens can go on outing
END IF
UNTIL scitizen >= 10 AND scitizen <= 36 Efficiency of Algorithm
IF statement to
print appropriate
error message
BEGIN
SET peoplename[1:39] AS STRING
SET extracitizen 0, remseats 0, count 0 AS INTEGER Efficiency of Algorithm
SET finalcost 0.0 AS FLOAT
Use of Array to store people
IF allpeople >= 12 AND allpeople <= 16 THEN name.
remseats 16 allpeople Uses REPEAT loop to validate
ELSE IF allpeople >= 17 AND allpeople <= 26 THEN extra citizens
remseats 26 allpeople Use of FOR loop to input and
ELSE print people names in array.
remseats 39 allpeople Recalculation of total cost
END IF including extra people.
REPEAT
PRINT Number of remaining seats on coach are, remseats
PRINT Enter the number of additional senior citizens going
INPUT extracitizen
IF extracitizen > remseats THEN
PRINT Not enough space to accommodate this many people
END IF
UNTIL extracitizens >= 0 AND extacitizen <= remseats
Validation of extra
people. It should be
greater or equal to
0 and less than or
equal to remaining
seats
BEGIN
SET difference 0.0 AS FLOAT
Efficiency of Algorithm
difference finalcost totalcost
IF difference > 0 THEN Use of variables from Task 1 &
PRINT The outing has made a profit
Task 2 for the calculation of
ELSE
difference.
PRINT The outing has broken even
Use of IF statement to identify
END IF
END the profit or broke even.
12 | P a g e Pre-Release Material (May/Jun17)
* variables from Task 1 & 2 has been underlined for easier readability
REPEAT
PRINT Enter the senior citizens going on outing?
INPUT scitizen
IF scitizen < mincitizen THEN
PRINT At least 10 senior citizens should go on outing
ELSE IF scitizen > maxcitizen THEN
PRINT Maximum of 36 senior citizens can go on outing
END IF
UNTIL scitizen >= 10 AND scitizen <= 36
REPEAT
PRINT Number of remaining seats on coach are, remseats
PRINT Enter the number of additional senior citizens going
INPUT extracitizen
IF extracitizen > remseats THEN
PRINT Not enough space to accommodate this many people
END IF
UNTIL extracitizens >= 0 AND extacitizen <= remseats
Practice Questions
1. When you performed the tasks, you used variables. Write suitable declarations for two of these.
State what you used each one for.
2. When you performed the tasks, you may have used constants. Write suitable declarations for two of
these. State what you used each one for.
3. Write an algorithm to complete Task 1, using either pseudocode, programming statements or a
flowchart.
4. Write an algorithm to complete Task 2, using either pseudocode, programming statements or a
flowchart.
5. Write an algorithm to complete Task 3, using either pseudocode, programming statements or a
flowchart. You should assume that Task 1 & Task2 has been already completed.
6. Explain how you performed validation of senior citizens input in Task 1. You can include pseudocode
or programming statements as part of your explanation.
7. Explain how you calculated total cost of the outing in Task 1. You can include pseudocode or
programming statements as part of your explanation.
8. In Task 2, explain how you calculated the remaining seats in the coach. You can include pseudocode
or programming statements as part of your explanation.
9. Explain how you completed Task 3. You should assume that Task 2 has been completed. You can
include pseudocode or programming statements as part of your explanation.
10. Comment on the efficiency of your design for Task 1.
11. Comment on the efficiency of your design for Task 2.
12. Comment on the efficiency of your design for Task 3.
13. Give a set of extra citizen data that could be used to check your validation rules in Task 2. Explain
why you chose this data set.