You are on page 1of 2

Private Sub Command1_Click()

Text1.Text = “ “

Text2.Text = “ “

Text3.Text = “ “

Text4.Text = “ “

Text5.Text = “ “

Text6.Text = “ “

Text7.Text = “ “

Text8.Text = “ “
Text9.Text = “ “

Text10.Text = “ “
Text11.Text = “ “

Text12.Text = “ “

End Sub

Private Sub Comand2_Click()

Dim X1, X2, X3, X4, P1, P2, q As Single

X1 = Val (Text1.Text)

X2 = Val (Text2.Text)

X3 = Val (Text3.Text)

X4 = Val (Text4.Text)

P1 = Val (Text5.Text)

P2 = Val (Text6.Text)

q = Val (Text7.Text)
If X1 < 0 Then

MsgBox “harga X1 tidak boleh kurang dari L”

Else

h = q * X2

RA = ( (h * (X2 + X3) ) + (P1 * (X3 + X4) ) + (P2 * X4) ) / (X1 + X2 + X3 + X4)

RB = ( (P2 * (X1 + X2 + X3) ) + (P1 * (X1 + X2) ) + (h * X2) ) / (X1 + X2 + X3 + X4)

MC = RA * X1

MD = RA * (X1 + X2) – h * (0.5 * X2)

ML = RA * (X1 + X2 + X3) – h * (0.5 * X2 + X2) – (P1 * X3)

Text8.Text = RA

Text9.Text = RB

Text10.Text = MC

Text11.Text = MD

Text12.Text = ML

End If

End Sub

You might also like