0% found this document useful (0 votes)
27 views2 pages

Scheme Tutorial

Uploaded by

ustazdanshirfan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

Scheme Tutorial

Uploaded by

ustazdanshirfan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Question 1

Consider the following scenario:

“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.

Table 1: Discount Table

(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:

Monthly instalment, m = (((3540 – 500) x 0.04) / 12) + ((3540 – 500) / 24)


a) Define a scheme function based on the above mathematical expression.
(3 marks)

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)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy