Professional Documents
Culture Documents
Pbe2 Faizul (1ddt21f1030)
Pbe2 Faizul (1ddt21f1030)
Pbe2 Faizul (1ddt21f1030)
CLASS DDT1B
PREPARED BY:
NO NAME MATRIC NO
5 Conclusion
TOTAL /30
DFC 10042 – PROBLEM SOLVING AND PROGRAM DESIGN PROBLEM
BASED EXERCISE 2
Duration: 2 Hours
Activity 2A
A magazine is sold at a price of RM11.00 per unit. The price get discount 10% if purchased
more than or equal to 10. The price get discount 5% if purchase between 9 to 7 units.
Based on given scenario, answer the following question:
a. Define and write appropriate variable names to solve the problem
- Quantity
- Discount
- Net price
- Units
b. Write a pseudocode and flowchart to solve that proble
Pseudocode
START
Input quantity
If(quantity>=10 unit)
Total = 11 x quantity
Discount = total x 0.10
Net price = total price - discount
Else
If(quantity< = 9 unit && < = 7 unit)
Total = 11 x quantity
Discount = total x 0.05
Net price = total price – discount
Else
Net price = 11 x quantity
End if
End if
Display net price
END
START
Input quantity
Total = 11 x quantity
If(quantity Discount = total x 0.10
>=10) Net Price = total discount
Total = 11 x quantity
If(quantity Discount = total x 0.05
>=9 && <=7) Net price = total discount
END
Activity 2B
3, 5, 7, 9,11, 13
Pseudocode
START
Set = 1
D 0{
Input num
Total = total + num
Num = num + 2
While
Output num
END
Activity 2C
Pseudocode
START
Set = 1
For (no = 1;no <= 13; no + 20)
Input Number
Total = total + num
End for
Outpu num
END
CONCLUTION
I can discover a solution to solve the pseudocode and design a flowchart to tackle the
problem by putting up this pbe2.