You are on page 1of 21

COURSEWORK

LEARNING AREA 5

PROGRAMMING
Practical Session
Please refer to Appendix B
Use Visual Basic to answer Question 6
RF.CW.LA5.S10.1
1. Problem Analysis
a. Problem Program untuk mengira luas segitiga
Statement

b. Required Nilai panjang segitiga


Input
Nilai ketinggian segitiga

c. Expected Nilai luas segitiga


Output

d. Formula Luas = x Panjang x Tinggi


Used
RF.CW.LA5.S10.1
2. Program Design
a. Pseudocode MULA
OR
Flowchart
INPUT PANJANG
DAN TINGGI

LUAS = X PANJANG X TINGGI

OUTPUT LUAS

TAMAT
RF.CW.LA5.S10.1
a. User
Interface Program to Calculate the Area
Design for of a Rectangle
Input input

Length of Rectangle

Width of Rectangle

Calculate
RF.CW.LA5.S10.1
b. User
Interface Program to Calculate the Area
Design of a Rectangle
for
Output
Length of Rectangle
output
Width of Rectangle

Area of Rectangle is xx

Calculate
RF.CW.LA5.S10.1
3. Coding
(refer to program submitted)
File name: S10_1.vbp Location: c:\ \Desktop\SKxxxA000\
4. Testing and Debugging
a. State the data Input item (s) Input data
used for each length 5
input item listed
width 6
in 1(b).
b. Write the Output item(s) Actual Output
output based area 30
on the input
data in 4(a)
c. Name of the S10_1.exe
executable file
Start Visual Basic
frmMain
txtLength

txtWidth

cmdExit

cmdCalc
lblArea
Private Sub cmdCalculate_Click()

Dim length As Single


Dim width As Single
Dim area As Single

Dim msg As String

length = Val(txtLength.Text)
width = Val(txtWidth.Text)
area = length * width

msg = "The area of the rectangle is "

lblArea.Caption = msg & area

End Sub
Private Sub cmdExit_Click()
End
End Sub
to compile
Thank You

You might also like