You are on page 1of 4

PROBLEM – SOLVING AND PROGRAMMING

1. A video game business sells online games to customers from across the region.
Users register online by entering their mobile phone number. Orders for one or more
than one game can then be placed using an online payment system. The games can
then be downloaded.
(a) Complete the following IPO chart for the above scenario.

INPUT PROCESSING OUTPUT

 Enter phone number 1. Order is recorded by the The games can be


business downloaded on your device.
2. The business ensures
that you have paid.
 Place order for 3. The game is available to
online game you.

(4 marks)
(b) Create a flow chart for the following algorithm. (click on start and click edit to continue the
drawing)
Input mobile phone number
If phone number is valid
Then
Place order for one or more than one game
Pay online
Download game(s)
Else invite user to register (10 marks)

START

ENTER MOBILE
PHONE NUMBER

IF PHONE
NUMBER
IS VALID
INVITE
PLACE ORDER FOR USER TO
ONE OR MORE REGISTER
THAN ONE GAMES

PAY ONLINE

DOWNLOAD
GAME

STOP
(c) Discounts are offered to loyal customers who download more than 10 games.

(i) Complete the following trace table using statements from the flow chart. (4 marks)

Row Loyal Customer? Quantity Over 10? Discount?

1 Y Y Y

2 Y N N

3 N Y N

4 N N N

(ii) Maria is a loyal customer who has bought 8 games so far. She introduces Jamie

to her new games. Jamie then orders 12 games but does not plan to order more.

State which rows from (c) (i) apply to Maria and to Jamie. (2 marks)

USER ROW

MARIA 2

JAMIE 3

(d) Write suitable variable names and C data types for EACH of the following variables

(6 marks)

Variable Suitable Variable Name Pascal Data Type

QUANTITY OVER 10? quantity Yes/no

LOYAL CUSTOMER? lc Yes/no

DISCOUNT? discount Yes/no


(e) Consider the following array named CUSTOMERS that stores the customers’ mobile
numbers.

Complete the following C statements to input a number, search for the number in the

array, and if found, output a statement.


_______char CNumber;__________________;

__gets______________ (__________C_______Number) ;

For INDEX = 1 to ___6____ Do

IF number = CUSTOMER [ __203-1100___ ]

THEN ______printf___________ (‘Loyal Customer’) ;

(4 marks)

Total 30 marks

You might also like