Midtest Q
Midtest Q
INSTRUCTIONS TO CANDIDATE:
EXAMINATION REQUIREMENTS:
NONE
This examination paper consists of THREE (3) printed pages including the front page.
QUESTION 1
Due to pandemic problem of COVID 19, Bantuan Prihatin Elektrik (BPE) is an additional
assistance package provided by the Government of Malaysia with TNB to all domestic
customers. Domestic customers who use electricity between 601 - 900 kWh per month will gain
a 10% discount (existing 2% discount rate + additional 8%) from April 2020 to September 2020.
The discount rates enjoyed by residential (domestic) customers are based on the total monthly
electricity consumption as shown in Table 1. Table 2 shows the block tarif rate and the values
are constant. Figure 1 shows a sample of customer’s bill. Discount BPE is total discount receive
by customer. Total usage is the total bill before discount and the total payment is the total bill
after discount.
Table 1: Discount Rate
Amount of Usage Total Bil Discount
1 - 200kWj (RM0.22 - RM44.00) 50%
201 - 300 kWj (RM68.34 – RM102.00) 25%
301 - 600 kWj (RM156.52 – RM312.00) 15%
601 - 900 kWj (RM402.67- RM603.00) 2% + *8%
>900 kWj (RM765.00 and above) 2%
2
Answer:
PAC
If AmountofUsage <=1 and <= 200 then i. Define the given data as
DiscountRate = 0.5 constants.
Else If AmountofUsage >=201 and <= 300 then ii. *Define the given data as
DiscountRate =0.25 input values [1M]
Else if AmountofUsage >=301 and <= 600 then
DiscountRate =0.15 [5M]
Else if AmountofUsage >=601 and <=900 then
DiscountRate =0.1
Else
DiscountRate =0.02
EndIf
Total_Usage = AmountofUsage * BlockTarifRate [0.5M]
Total_Payment = Total_Usage – (Total_Usage * DiscountRate)
[1.5M]
3
IC: [3M]
CalcTotalBillControl
0000
IPO:
Input [1.25M] Processing Module Output [4.5M]
[2M]
AccountNo, 1. Enter AccountNo Read (1000)
CustomerName, 2. Enter CustomerName Read (1000)
[2.5M]
Address, 3. Enter Address Read (1000)
BillDate, 4. Enter BillDate Read (1000)
AmountofUsage 5. Enter AmountofUsage Read (1000)
6. If AmountofUsage <=1 and <= 200 then
DiscountRate = 0.5
7. Else If AmountofUsage >=201 and <= 300 then
DiscountRate = 0.25
8. Else if AmountofUsage >=301 and <= 600 then
DiscountRate = 0.15
9. Else if AmountofUsage >=601 and <=900 then
DiscountRate = 0.1
10. Else
DiscountRate = 0.02
11. Calculate Total_Usage = AmountofUsage * Calculate
BlockTarifRate [0.75M] (2000)
4
12. Calculate Total_Payment = Total_Usage – Calculate
(Total_Usage * DiscountRate) [1.5M] (2000)
13. Print AccountNo Print (3000)
AccountNo,
14. Print CustomerName Print (3000)
CustomerName
15. Print Address [2.5M] Print (3000)
Address,
16. Print BillDate Print (3000)
BillDate,
17. Print AmountofUsage Print (3000)
AmountofUsage,
18. Print Discount Rate Print (3000)
DiscountRate,
19. Print Discount BPE Print (3000)
DiscountBPE,
20. Print Total_Usage Print (3000)
Total_Usage,
21. Print Total_Payment Print (3000)
Total_Payment
22. End CalcTotalBi
llControl
(0000)
b) Identify variables, constant and data type for each of the item: [10Marks]
Variables [5Marks] Data type [5Marks]
AccountNo String
CustomerName String
Address String
BillDate String / Date
AmountofUsage Int
DiscountBPE Float
Total_Usage Float
Total_Payment Float
Constant Data type
BlockTarifRate Float
DiscountRate Float
5
c) Based on the custmer’s bill as in Figure 1, solve the calculation of total payment with an
amount of usage is 750 kWj and total usage is RM 502.50 by following the hierarchy of
operations. Total payment = A, Total usage = B, Discount (2%) = C, Discount (8%) = D.
[5Marks]
A = B – (B * (C+D))
Answer:
A = B – (B * (C+D))
3
4
2 B* resultant of 1 50.25
3 B – resultant of 2 452.25
d) Write an algorithm with decision logic for the given problem. [15 Marks]
Answer:
1. CalcTotalBill ( )
2. Enter AccountNo
3. Enter CustomerName
[3M]
4. Enter Address
5. Enter BillDate
6. Enter AmountofUsage
7. If AmountofUsage <=1 and <= 200 then
8. DiscountRate = 0.5
9. Else If AmountofUsage >=201 and <= 300 then
10. DiscountRate = 0.25
6
11. Else if AmountofUsage >=301 and <= 600 then
12. DiscountRate = 0.15 [5M]
13. Else if AmountofUsage >=601 and <=900 then
14. DiscountRate = 0.1
15. Else
16. DiscountRate = 0.02
17. EndIf
18. Calculate Total_Usage = AmountofUsage * BlockTarifRate [1M]
19. Calculate Total_Payment = Total_Usage – (Total_Usage * DiscountRate) [1M]
20. Print AccountNo
21. Print CustomerName
22. Print Address
23. Print BillDate
24. Print AmountofUsage
25. Print Discount Rate [5M]
26. Print Discount BPE
27. Print Total_Usage
28. Print Total_Payment
29. End
Start [0.5M]
A
[1M]
AmountofUsage T DiscountRate =0.5
<=1 and <= 200? Calculate Total_Payment = Total_Usage –
(Total_Usage * DiscountRate)
F
[4.5M]
AmountofUsage T DiscountRate =0.25 Print
V
>=201 and <= 300?
7
AccountNo,
CustomerNam
e, Address,
F BillDate,
[0.5M]
Processing 2.5M
Decision 2M
Line / True / False 0.5
8
Trace the logic of the algorithm by executing desk checking using the set data in Figure 1 and Block Tarif Rate in Table 2. [20
Marks] [5.5M]
V
No Accoun Customer Address BillDate Amount Discount TotalUsage TotalPayment Condition I/O
tNo Name of Usage Rate
1.
19. 502.50-
(502.50*0.1) = [1.5M]
452.25
20. “225245”
21. “Abdullah bin Osman”
10
23. “15/06/2020”
24. 750
25. 0.1
26. 50.25
27. 502.50
28. 452.25
29.
11