Tutorial Book Scheme Topic 2 Sequence (pg.4-pg32)
Tutorial Book Scheme Topic 2 Sequence (pg.4-pg32)
1. Problem solving is a conceptual process that involves discovering, analyzing, and solving
problems.
(a) State the importance of algorithm in problem solving.
- An algorithm is a step-by-step instruction that will transform the input into the output
that can be represent using pseudocode or flow chart that can help the programmer to
build a program.
The control structure that directs the computer to proses each instruction in the order
listed in the program
2.0 Design a Solution [SEQUENCE]
4. Ahmad wants to create a program that determines the total area of a piece of land where
length and width are given.
Step 1: Problem Analysis
Input Process Output
length, width Calculate total area of a piece of land total area of a piece of
based on length and width. land
START
START
STOP
2.0 Design a Solution [SEQUENCE]
5. Calculate and print the volume of a sphere based on the formula given below.
4
Volume of sphere = 3 𝜋𝑟 3
Step 1: Problem Analysis
Input Process Output
r Calculate the volume of sphere based volume of sphere
on r
Start
READ r
volume of a sphere = 1.33 x 3.142 x r x r x r
PRINT volume of a sphere
Stop
START
READ r
STOP
2.0 Design a Solution [SEQUENCE]
6. Convert a measurement in millimeter (mm) to meter (m) and print the result.
START
Read millimeter
meter = millimeter/ 1000
Print meter
STOP
START
READ millimeter
PRINT meter
STOP
2.0 Design a Solution [SEQUENCE]
7. A government tax of 10% and service tax of 5% will be added to the price of a set of meal
bought at MFC. Calculate the total price that Ali has to pay for a set of meal.
Start OR
READ price Start
total price = price x 1.15 READ price
PRINT total price total price = price + (0.15 x price)
Stop PRINT total price
Stop
START
READ price
STOP
2.0 Design a Solution [SEQUENCE]
8. A program that reads two numbers and print their sum and product.
START
STOP
START
READ NUMBER1,NUMBER2
PRINT sum,product
STOP
2.0 Design a Solution [SEQUENCE]
Start
READ radius
START
READ radius
STOP
2.0 Design a Solution [SEQUENCE]
During the school holidays, the hotel offers 10% discount on the total room charge. You
are going to make a reservation on one Superior room and one Deluxe room for a few
nights. Calculate and display the total room charge that you must pay.
START
Read nights
total room charge = 0.9 x (nights x (160+180) )
Print total room charge
STOP
START
READ nights
PRINT total
room charge
STOP
2.0 Design a Solution [SEQUENCE]
11. Gary Onn is one of the famous fashion designers. In conjunction with 25th anniversary,
25% discount will be given to all dresses. Calculate the price after discount.
Step 1: Problem Analysis
Input price
START
Read price
price after discount = price – (price x 0.25)
Print price after discount
STOP
START
START
Read price
price after discount = price x 0.75
Print price after discount READ price
STOP
STOP
2.0 Design a Solution [SEQUENCE]
12. A factory worker gets a monthly salary based on basic payment and overtime. The basic
payment is RM1, 820.00 and overtime will be paid RM5 per hour. Calculate the monthly
nett salary for the factory worker after deducting 12% of KWSP.
START OR
READ hour START
overtime = 5 x hour READ hour
salary = 1820 + overtime nett salary = (1820 + (5 x hour) ) x 0.88
KWSP = 0.12 x salary PRINT nett salary
nett salary = salary - KWSP STOP
PRINT nett salary
STOP
START
READ hour
STOP
2.0 Design a Solution [SEQUENCE]
13. Calculate and display the area of shaded region in the diagram below.
Process
Calculate the area of shaded region based on A , B, C
Output
area of shaded region
START
START
Read A , B , C
area of shaded = (A x B) – (1/2 x B x C) READ A , B , C
Print area of shaded
STOP
STOP
2.0 Design a Solution [SEQUENCE]
14. Siti is a salesperson for a company that sells used computers. The price for Brand A is RM
500 per unit while Brand B costs RM 1000 per unit. The company will pay her 10%
commission for the total sales where total sale will be calculated based on the number of
computers sold for both brands.
15. Step 1: Problem Analysis
Input BrandA
BrandB
Output commission
START
READ BrandA,
BrandB
PRINT commission
Start STOP
16. Ahmad plans to install floor tiles for his car parking space which is rectangular in shape.
The price per square feet of floor tiles will be determined after Ahmad chooses the
suitable tiles. Calculate and display the area of Ahmad’s parking space and the total cost
of tiles needed to be paid by him.
Process Calculate the area and total cost based on width, length and price per square feet
Start
START
STOP
2.0 Design a Solution [SEQUENCE]
Process
Calculate totalFee based on monthly fee
Output totalFee
Start
START
PRINT totalFee
STOP
2.0 Design a Solution [SEQUENCE]
18. The manager of RZX Bookstore plans to promote his bookstore by giving a discount of
15% for each book. Calculate and display the price after discount for one book purchased.
Start OR
Read price Start OR
discount = 0.15 x price Read price Start
price after discount = price -discount price after discount = price x 0.85 Read price
Print price after discount Print price after discount price after discount = price -
Stop Stop (price x 0.15)
START
READ price
STOP
2.0 Design a Solution [SEQUENCE]
19. Sheena lives in Ipoh. She has to commute from Ipoh to Gopeng 5 days a week and have to
pay RM3.20 every time she goes through the toll. Calculate the toll amount to be paid by
Sheena every month. (Assume 1 month = 4 weeks)
Output
toll amount to be paid
Start
START
STOP
2.0 Design a Solution [SEQUENCE]
20. Calculate the total amount customer needs to pay for a set of lunch meal and a set of kid’s
meal ordered with 10% sales and service tax (SST) charged. Display the total nett price
paid based on quantity bought.
Item Price
Lunch Meal RM7.90
Kid’s meal RM5.70
Process Calculate the total nett price based on quantity lunch meal and quantity of
kid’s meal
Start
Read quantity of Lunch Meal, quantity of Kid’s meal
total nett price = (quantity of Lunch Meal x 7.90) + (quantity of Kid’s meal x 5.7) x 1.10
Print total nett price
Stop
START
total nett price = (quantity of Lunch Meal x 7.90) + (quantity of Kid’s meal x 5.7) x 1.10
STOP
2.0 Design a Solution [SEQUENCE]
Start
Read Name, Age Start
Display Name, Age
Stop
Read Name, Age
Stop
2.0 Design a Solution [SEQUENCE]
Process
Calculate Ahmad’s age based on current year, born year
Start
START
STOP
2.0 Design a Solution [SEQUENCE]
23. You are asked to calculate the area of shaded region of two circles in FIGURE 1.
Process
Calculate the area of shaded region based on r1, r2
Start
Read r1, r2
area of shaded region = (3.142 x r2 x r2) – (3.142 x r1 x r1)
Print area of shaded region
Stop
START
READ r1, r2
STOP
2.0 Design a Solution [SEQUENCE]
24. ABC Supermarket offers 20% discount for each item that is bought during Year End Sale
(YES). The discount and price after discount will be calculated based on the given normal
price. As the result, price after discount will be displayed.
Step 1: Problem Analysis
Input normal price
START
Read normal price
Price after discount = normal price×0.8
Print price after discount
STOP
START
STOP
2.0 Design a Solution [SEQUENCE]
25. Calculate the price of a cup of coffee sold at MyKopitiam Cafe. The price is based on the
number of scoops of espresso coffee, sugar syrup and milk. The prices of espresso coffee,
sugar syrup and milk are RM5, RM3 and RM0.20 per scoop respectively.
Process
Calculate the price of a cup of coffee based on scoopEspresso, scoopSugar,
scoopMilk.
Output
price of a cup of coffee
STOP
START
STOP
2.0 Design a Solution [SEQUENCE]
26. Meatz Place Café prints a receipt for its customers as shown in FIGURE 2. The unit price
for each item is fixed and stored by the system. The date and
time are automatically generated by the system.
quantity, item
(b) Besides the item, unit price, quantity, date and time,
state the other outputs produced by the system.
(c) State two (2) of the process involved to produce the above outputs.
price = unit price x quantity
total = subtotal x 1.06
2.0 Design a Solution [SEQUENCE]
27. With the escalating price of fuel, the need to understand the car fuel consumption has
become increasingly important. In April 2017, you have made 10 journeys. You want to
know the average fuel consumption for month of April 2017. Assume that your car can
read the mileage, in kilometer (km) and the fuel tank level, in liter (L) at the beginning
and at the end of journey.
Step 1: Problem Analysis
Input mileage, fuelBegin, fuelEnd
Process Calculate average fuel consumption based on mileage, fuelBegin, fuelEnd for 10
journeys
Start
Read mileage, fuelBegin, fuelEnd
average fuel consumption = ( (fuelBegin - fuelEnd) / mileage) / 10
Print average fuel consumption
Stop
START
STOP
2.0 Design a Solution [SEQUENCE]
28. Mr. Rahman plans to make a reservation for a hotel room in Langkawi. The room rate is
RM250.00 per night and the sales and service charge is 15% of the room rate. Determine
the total payment if he books the hotel room for n nights. List the input, processes
involved to calculate the total payment and the output.
Process
Calculate the total payment based on n
Output
total payment
START
Read n
total payment = (n x 250) x 1.15
Print total payment
STOP
START
READ n
STOP
2.0 Design a Solution [SEQUENCE]
START
START
STOP
2.0 Design a Solution [SEQUENCE]
30. A customer books flight ticket through an online system. For each transaction, the
customer has to pay total flight charges based on number of passengers and the cabin
class price.
START
START
STOP
2.0 Design a Solution [SEQUENCE]
31. The Computer Science lecturers wish to determine the final marks for every student. The
final marks are taken from average marks of three (3) quizzes and total marks of two
(2) tests. Print the final marks for each student.
Step 1: Problem Analysis
Input quiz1, quiz2, quiz3, test1, test2
Process Calculate the final marks based on quiz1, quiz2, quiz3, test1 and test2 entered
Output final marks
START
START
STOP
2.0 Design a Solution [SEQUENCE]
32. Nafisah lives in Uganda that charges 3% income tax on her annual salary. She wants to
calculate the amount of tax that she needs to pay.
rE
START
START
STOP