Pbe2 Faizul (1ddt21f1030)

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

DEPARTMENT OF INFORMATION

TECHNOLOGY & COMMUNICATION

LABSHEET / TUTORIAL REPORT


COURSE DFC 10042

TITLE PROBLEM SOLVING AND PROGRAM DESIGN

CLASS DDT1B

PREPARED BY:
NO NAME MATRIC NO

1. MUHAMMAD FAIZULASYRAF BIN ZULKEFLI 12DDT21F1030

PREPARED FOR: ROSMAYATI BT. ISMAIL

N PERFORMANCE AREA SCORE


O
1 Content Development and
Organization
2 Respond to Assessment

3 Write with proper language


and correct grammar
4 Format

5 Conclusion

TOTAL /30
DFC 10042 – PROBLEM SOLVING AND PROGRAM DESIGN PROBLEM
BASED EXERCISE 2

Duration: 2 Hours

CLO2: Demonstrate effective communication both on orally or in writing about problem


solving skills by using different types of programming tools to solve a given problem.

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

Display net price Net price = quantity x 11

END
Activity 2B

Write a pseudocode to provide an output as below using do… While statement.

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

Convert pseudocode in Activity 2B using for statement

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.

You might also like