Scheme Tutorial
Scheme Tutorial
“Saif just moved from Kuala Lumpur to Sabah. His new school quite very far from his house
and the area do not have public transport so he decided to use motorcycle to go to school.
Saif is 15 years old and want to apply for motorcycle driving license. Eligibility age to apply for
a motorcycle license in Malaysia must be 16 years old and above.”
a) Create a Scheme if statement that display “Eligible to apply for motorcycle driving
license” for age above 15 years old and display “Not eligible to apply for motorcycle
driving license” for age below 16 years old.
(2 marks)
b) Modify the Scheme if statement in (i) above to Scheme condition statement with
additional information below:
“Eligibility age to apply for a car driving license in Malaysia must be 17 years old and
above.”
(3 marks)
Question 2
ABC Sdn Bhd is organizing Hari Raya sale for all items in the shop. As a programmer you
need to create Scheme code to help in calculating for each customer as the discount is given
based on total price of all items. Table 1 below shows the discount given based on customer
purchase.
(5 marks)
Question 3
A book shop has 12000 Programming Paradigms books and the thickness of each book is
2.5 cm.
a) Write the formula in Scheme to compute the length of a rack that is long enough to put
all the books, then give the answer in cm.
(2.5 marks)
b) If the length of the existing rack is 250 meters, based on your previous answer, write
the formula in Scheme to discover number of books that cannot be loaded onto the
rack, then state the number of the books.
(2.5 marks)
Question 4
Puteri bought a new handphone for RM3540. She was allowed to trade in her old handphone
for RM500 with a special mobile data package. The rest of it she opted for a monthly instalment
of 4% per annum interest for 2 years. The monthly instalment is calculat ed based on the
mathematical expression below:
b) Based on mobile data package offered below in Table 1, write a function definition in
Scheme to calculate total charge for her monthly telephone bill.
Table 1
Package SMS Data Call rate per minute Call price per
minute (RM)
0 min – 120 min 0.30
Gold Free 10GB 121 min – 300 min 0.50
> 300 min 0.80
(4 marks)