Minggu, 27 Juni 2010

Metode Simpleks




































Listing Program dari Program Metode Simpleks

Private Sub DISS_Click()
If Int(X1A) < kk1 =" X1A" kk2 =" X1B" kk3 =" X1C" kk4 =" X1D" caption = "CB" vganti_bp = "CB" style="">
Else
kk1 = X2A
KK2 = X2B
KK3 = X2C
KK4 = X2D
Label22.Caption = "PR"
VGANTI_BP = "PR"
End If
If KK2 = 0 Then
A = 0
Else
A = NK2 / KK2
If KK3 = 0 Then
B = 0
Else
B = NK3 / KK3
If KK4 = 0 Then
C = 0
Else
C = NK4 / KK4
End If
End If
End If
If A < style=""> x = A
F = KK2
P = Z2 / F
Q = X1B / F
R = X2B / F
S = S1B / F
T = S2B / F
U = S3B / F
V = NK2 / F
Z1.Text = Z1 - (kk1 * P)
X1A.Text = X1A - (kk1 * Q)
X2A.Text = X2A - (kk1 * R)
S1A.Text = S1A - (kk1 * S)
S2A.Text = S2A - (kk1 * T)
S3A.Text = S3A - (kk1 * U)
NK1.Text = NK1 - (kk1 * V)
Z3.Text = Z1 - (KK3 * P)
X1C.Text = X1C - (KK3 * Q)
X2C.Text = X2C - (KK3 * R)
S1C.Text = S1C - (KK3 * S)
S2C.Text = S2C - (KK3 * T)
S3C.Text = S3C - (KK3 * U)
NK3.Text = NK3 - (KK3 * V)
Z4.Text = Z4 - (KK4 * P)
X1D.Text = X1D - (KK4 * Q)
X2D.Text = X2D - (KK4 * R)
S1D.Text = S1D - (KK4 * S)
S2D.Text = S2D - (KK4 * T)
S3D.Text = S3D - (KK4 * U)
NK4.Text = NK4 - (KK4 * V)
Z2.Text = P
X1B.Text = Q
X2B.Text = R
S1B.Text = S
S2B.Text = T
S3B.Text = U
NK2.Text = V
Label17.Caption = VGANTI_BP
ElseIf A <> C And A > C Then
x = C
F = KK4
P = Z4 / F
Q = X1D / F
R = X2D / F
S = S1D / F
T = S2D / F
U = S3D / F
V = NK4 / F
Z1.Text = Z1 - (kk1 * P)
X1A.Text = X1A - (kk1 * Q)
X2A.Text = X2A - (kk1 * R)
S1A.Text = S1A - (kk1 * S)
S2A.Text = S2A - (kk1 * T)
S3A.Text = S3A - (kk1 * U)
NK1.Text = NK1 - (kk1 * V)
Z2.Text = Z2 - (KK2 * P)
X1B.Text = X1B - (KK2 * Q)
X2B.Text = X2B - (KK2 * R)
S1B.Text = S1B - (KK2 * S)
S2B.Text = S2B - (KK2 * T)
S3B.Text = S3B - (KK2 * U)
NK2.Text = NK2 - (KK2 * V)
Z3.Text = Z1 - (KK3 * P)
X1C.Text = X1C - (KK3 * Q)
X2C.Text = X2C - (KK3 * R)
S1C.Text = S1C - (KK3 * S)
S2C.Text = S2C - (KK3 * T)
S3C.Text = S3C - (KK3 * U)
NK3.Text = NK3 - (KK3 * V)
Z4.Text = P
X1D.Text = Q
X2D.Text = R
S1D.Text = S
S2D.Text = T
S3D.Text = U
NK4.Text = V
Label19.Caption = "CB"
ElseIf A <> C And A < style=""> x = A
F = KK2
P = Z2 / F
Q = X1B / F
R = X2B / F
S = S1B / F
T = S2B / F
U = S3B / F
V = NK2 / F
Z1.Text = Z1 - (kk1 * P)
X1A.Text = X1A - (kk1 * Q)
X2A.Text = X2A - (kk1 * R)
S1A.Text = S1A - (kk1 * S)
S2A.Text = S2A - (kk1 * T)
S3A.Text = S3A - (kk1 * U)
NK1.Text = NK1 - (kk1 * V)
Z3.Text = Z1 - (KK3 * P)
X1C.Text = X1C - (KK3 * Q)
X2C.Text = X2C - (KK3 * R)
S1C.Text = S1C - (KK3 * S)
S2C.Text = S2C - (KK3 * T)
S3C.Text = S3C - (KK3 * U)
NK3.Text = NK3 - (KK3 * V)
Z4.Text = Z4 - (KK4 * P)
X1D.Text = X1D - (KK4 * Q)
X2D.Text = X2D - (KK4 * R)
S1D.Text = S1D - (KK4 * S)
S2D.Text = S2D - (KK4 * T)
S3D.Text = S3D - (KK4 * U)
NK4.Text = NK4 - (KK4 * V)
Z2.Text = P
X1B.Text = Q
X2B.Text = R
S1B.Text = S
S2B.Text = T
S3B.Text = U
NK2.Text = V
Label17.Caption = VGANTI_BP
ElseIf A < b =" C" style=""> x = A
F = KK2
P = Z2 / F
Q = X1B / F
R = X2B / F
S = S1B / F
T = S2B / F
U = S3B / F
V = NK2 / F
Z1.Text = Z1 - (kk1 * P)
X1A.Text = X1A - (kk1 * Q)
X2A.Text = X2A - (kk1 * R)
S1A.Text = S1A - (kk1 * S)
S2A.Text = S2A - (kk1 * T)
S3A.Text = S3A - (kk1 * U)
NK1.Text = NK1 - (kk1 * V)
Z3.Text = Z1 - (KK3 * P)
X1C.Text = X1C - (KK3 * Q)
X2C.Text = X2C - (KK3 * R)
S1C.Text = S1C - (KK3 * S)
S2C.Text = S2C - (KK3 * T)
S3C.Text = S3C - (KK3 * U)
NK3.Text = NK3 - (KK3 * V)
Z4.Text = Z4 - (KK4 * P)
X1D.Text = X1D - (KK4 * Q)
X2D.Text = X2D - (KK4 * R)
S1D.Text = S1D - (KK4 * S)
S2D.Text = S2D - (KK4 * T)
S3D.Text = S3D - (KK4 * U)
NK4.Text = NK4 - (KK4 * V)
Z2.Text = P
X1B.Text = Q
X2B.Text = R
S1B.Text = S
S2B.Text = T
S3B.Text = U
NK2.Text = V
Label17.Caption = VGANTI_BP
ElseIf A > B And B <> C Then
x = B
F = KK3
P = Z3 / F
Q = X1C / F
R = X2C / F
S = S1C / F
T = S2C / F
U = S3C / F
V = NK3 / F
Z1.Text = Z1 - (kk1 * P)
X1A.Text = X1A - (kk1 * Q)
X2A.Text = X2A - (kk1 * R)
S1A.Text = S1A - (kk1 * S)
S2A.Text = S2A - (kk1 * T)
S3A.Text = S3A - (kk1 * U)
NK1.Text = NK1 - (kk1 * V)
Z2.Text = Z2 - (KK2 * P)
X1B.Text = X1B - (KK2 * Q)
X2B.Text = X2B - (KK2 * R)
S1B.Text = S1B - (KK2 * S)
S2B.Text = S2B - (KK2 * T)
S3B.Text = S3B - (KK2 * U)
NK2.Text = NK2 - (KK2 * V)
Z4.Text = Z4 - (KK4 * P)
X1D.Text = X1D - (KK4 * Q)
X2D.Text = X2D - (KK4 * R)
S1D.Text = S1D - (KK4 * S)
S2D.Text = S2D - (KK4 * T)
S3D.Text = S3D - (KK4 * U)
NK4.Text = NK4 - (KK4 * V)
Z3.Text = P
X1C.Text = Q
X2C.Text = R
S1C.Text = S
S2C.Text = T
S3C.Text = U
NK3.Text = V
Label18.Caption = VGANTI_BP
ElseIf A > B And B < style=""> x = B
F = KK3
P = Z3 / F
Q = X1C / F
R = X2C / F
S = S1C / F
T = S2C / F
U = S3C / F
V = NK3 / F
Z1.Text = Z1 - (kk1 * P)
X1A.Text = X1A - (kk1 * Q)
X2A.Text = X2A - (kk1 * R)
S1A.Text = S1A - (kk1 * S)
S2A.Text = S2A - (kk1 * T)
S3A.Text = S3A - (kk1 * U)
NK1.Text = NK1 - (kk1 * V)
Z2.Text = Z2 - (KK2 * P)
X1B.Text = X1B - (KK2 * Q)
X2B.Text = X2B - (KK2 * R)
S1B.Text = S1B - (KK2 * S)
S2B.Text = S2B - (KK2 * T)
S3B.Text = S3B - (KK2 * U)
NK2.Text = NK2 - (KK2 * V)
Z4.Text = Z4 - (KK4 * P)
X1D.Text = X1D - (KK4 * Q)
X2D.Text = X2D - (KK4 * R)
S1D.Text = S1D - (KK4 * S)
S2D.Text = S2D - (KK4 * T)
S3D.Text = S3D - (KK4 * U)
NK4.Text = NK4 - (KK4 * V)
Z3.Text = P
X1C.Text = Q
X2C.Text = R
S1C.Text = S
S2C.Text = T
S3C.Text = U
NK3.Text = V
Label18.Caption = VGANTI_BP
ElseIf A > B And B < a =" C" style=""> x = B
F = KK3
P = Z3 / F
Q = X1C / F
R = X2C / F
S = S1C / F
T = S2C / F
U = S3C / F
V = NK3 / F
Z1.Text = Z1 - (kk1 * P)
X1A.Text = X1A - (kk1 * Q)
X2A.Text = X2A - (kk1 * R)
S1A.Text = S1A - (kk1 * S)
S2A.Text = S2A - (kk1 * T)
S3A.Text = S3A - (kk1 * U)
NK1.Text = NK1 - (kk1 * V)
Z2.Text = Z2 - (KK2 * P)
X1B.Text = X1B - (KK2 * Q)
X2B.Text = X2B - (KK2 * R)
S1B.Text = S1B - (KK2 * S)
S2B.Text = S2B - (KK2 * T)
S3B.Text = S3B - (KK2 * U)
NK2.Text = NK2 - (KK2 * V)
Z4.Text = Z4 - (KK4 * P)
X1D.Text = X1D - (KK4 * Q)
X2D.Text = X2D - (KK4 * R)
S1D.Text = S1D - (KK4 * S)
S2D.Text = S2D - (KK4 * T)
S3D.Text = S3D - (KK4 * U)
NK4.Text = NK4 - (KK4 * V)
Z3.Text = P
X1C.Text = Q
X2C.Text = R
S1C.Text = S
S2C.Text = T
S3C.Text = U
NK3.Text = V
Label18.Caption = VGANTI_BP
ElseIf A > B And B > C And A > C Then
x = C
F = KK4
P = Z4 / F
Q = X1D / F
R = X2D / F
S = S1D / F
T = S2D / F
U = S3D / F
V = NK4 / F
Z1.Text = Z1 - (kk1 * P)
X1A.Text = X1A - (kk1 * Q)
X2A.Text = X2A - (kk1 * R)
S1A.Text = S1A - (kk1 * S)
S2A.Text = S2A - (kk1 * T)
S3A.Text = S3A - (kk1 * U)
NK1.Text = NK1 - (kk1 * V)
Z2.Text = Z2 - (KK2 * P)
X1B.Text = X1B - (KK2 * Q)
X2B.Text = X2B - (KK2 * R)
S1B.Text = S1B - (KK2 * S)
S2B.Text = S2B - (KK2 * T)
S3B.Text = S3B - (KK2 * U)
NK2.Text = NK2 - (KK2 * V)
Z3.Text = Z1 - (KK3 * P)
X1C.Text = X1C - (KK3 * Q)
X2C.Text = X2C - (KK3 * R)
S1C.Text = S1C - (KK3 * S)
S2C.Text = S2C - (KK3 * T)
S3C.Text = S3C - (KK3 * U)
NK3.Text = NK3 - (KK3 * V)
Z4.Text = P
X1D.Text = Q
X2D.Text = R
S1D.Text = S
S2D.Text = T
S3D.Text = U
NK4.Text = V
Label19.Caption = VGANTI_BP
Else
If A = B And B > C And A > C Then
x = C
F = KK4
P = Z4 / F
Q = X1D / F
R = X2D / F
S = S1D / F
T = S2D / F
U = S3D / F
V = NK4 / F
Z1.Text = Z1 - (kk1 * P)
X1A.Text = X1A - (kk1 * Q)
X2A.Text = X2A - (kk1 * R)
S1A.Text = S1A - (kk1 * S)
S2A.Text = S2A - (kk1 * T)
S3A.Text = S3A - (kk1 * U)
NK1.Text = NKZ2.Text = Z2 - (KK2 * P)
X1B.Text = X1B - (KK2 * Q)
X2B.Text = X2B - (KK2 * R)
S1B.Text = S1B - (KK2 * S)
S2B.Text = S2B - (KK2 * T)
S3B.Text = S3B - (KK2 * U)
NK2.Text = NK2 - (KK2 * V)
Z3.Text = Z1 - (KK3 * P)
X1C.Text = X1C - (KK3 * Q)
X2C.Text = X2C - (KK3 * R)
S1C.Text = S1C - (KK3 * S)
S2C.Text = S2C - (KK3 * T)
S3C.Text = S3C - (KK3 * U)
NK3.Text = NK3 - (KK3 * V)
Z4.Text = P
X1D.Text = Q
X2D.Text = R
S1D.Text = S
S2D.Text = T
S3D.Text = U
NK4.Text = V
Label19.Caption = VGANTI_BP
If Label17.Caption = "CB" Then
Text8.Text = NK2
ElseIf Label18.Caption = "CB" Then
Text8.Text = NK3
ElseIf Label19.Caption = "CB" Then
Text8.Text = NK4
ElseIf Label17.Caption = "PR" Then
Text9.Text = NK2
ElseIf Label18.Caption = "PR" Then
Text9.Text = NK3
ElseIf Label19.Caption = "PR" Then
Text9.Text = NK4
End If
End If
End If
End Sub

Private Sub HSL_Click()
Z1.Text = 1
Z2.Text = 0
Z3.Text = 0
Z4.Text = 0
X1A.Text = (CB * -1)
X1B.Text = CB1
X1C.Text = CB2
X1D.Text = CB3
X2A.Text = (PR * -1)
X2B.Text = PR1
X2C.Text = PR2
X2D.Text = PR3
S1A.Text = 0
S1B.Text = 1
S1C.Text = 0
S1D.Text = 0
S2A.Text = 0
S2B.Text = 0
S2C.Text = 1
S2D.Text = 0
S3A.Text = 0
S3B.Text = 0
S3C.Text = 0
S3D.Text = 1
NK1.Text = 0
NK2.Text = TOTAL1
NK3.Text = TOTAL2
NK4.Text = TOTAL3
End Sub

Private Sub KELUAR_Click()
Unload Me
End Sub

Private Sub ULANG_Click()
CB.Text = ""
PR.Text = ""
CB1.Text = ""
CB2.Text = ""
CB3.Text = ""
PR1.Text = ""
PR2.Text = ""
PR3.Text = ""
TOTAL1.Text = ""
TOTAL2.Text = ""
TOTAL3.Text = ""
End Sub

Menghitung Persegi Panjang













Coding Program Menghitung Luas Persegi Panjang


Private Sub cmd_proses_Click()
If opt_luas.Value = True Then
txt_hasil.Text = Val(txt_1.Text) * Val(txt_2.Text)
ElseIf opt_panjang.Value = True Then
txt_hasil.Text = Val(txt_1.Text) / Val(txt_2.Text)
Else
txt_hasil.Text = Val(txt_1.Text) / Val(txt_2.Text)
End If
End Sub

Private Sub cmd_ulang_Click()
Label1.Caption = "PANJANG"
Label2.Caption = "LEBAR"
opt_luas.Value = True
txt_1.Text = ""
txt_2.Text = ""
txt_hasil.Text = ""
End Sub

Private Sub Command1_Click()
MsgBox "Yakin Anda mau keluar sekarang...?", vbInformation + vvokonly, "Keluar"
End
End Sub

Private Sub opt_lebar_Click()
If opt_lebar.Value = True Then
Label1.Caption = "LUAS"
Label2.Caption = "PANJANG"
End If
End Sub

Private Sub opt_luas_Click()
If opt_luas.Value = True Then
Label1.Caption = "PANJANG"
Label2.Caption = "LEBAR"
End If
cmd_proses.SetFocus
End Sub

Private Sub opt_panjang_Click()
If opt_panjang.Value = True Then
Label1.Caption = "LUAS"
Label2.Caption = "LEBAR"
End If
End Sub

Private Sub txt_1_KeyPress(KeyAscii As Integer)
If KeyAscii >= 65 And KeyAscii <= 90 Or KeyAscii >= 97 And KeyAscii <= 122 Then
KeyAscii = 0
KeyAscii = 0
End If
If KeyAscii = 13 Then
txt_2.SetFocus
End If
End Sub

Private Sub txt_2_Change()
If KeyAscii >= 65 And KeyAscii <= 90 Or KeyAscii >= 97 And KeyAscii <= 122 Then
KeyAscii = 0
KeyAscii = 0
End If
End Sub

Private Sub txt_hasil_Change()
If KeyAscii >= 65 And KeyAscii <= 90 Or KeyAscii >= 97 And KeyAscii <= 122 Then
KeyAscii = 0
KeyAscii = 0
End If
txt_hasil.Enabled = False
End Sub

Mencari Faktorial











Coding program mencari Faktorial :

Private Sub angka_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmdfaktorial.SetFocus
End If
End Sub

Private Sub cmdend_Click()
End
End Sub

Private Sub cmdfaktorial_Click()
bil = 1
aa = Val(angka.Text) + 1
For i = 1 To Val(angka.Text)
bil = bil * i
aa = aa - 1
If i = 1 Then
txtfaktorial.Text = angka.Text
Else
txtfaktorial.Text = txtfaktorial.Text & " x " & Str(aa)
End If
Next
hasilfaktorial.Text = Str(bil)
txtfaktorial.Text = txtfaktorial.Text & " = " & Str(bil)
txtfaktorial.Enabled = False
hasilfaktorial.Enabled = False
End Sub

Private Sub cmdulang_Click()
angka.Text = ""
txtfaktorial.Text = ""
hasilfaktorial.Text = ""
angka.SetFocus
End Sub

Mencari Bilangan Ganjil/Genap























Coding program mencari bilangan ganjil genap:

Private Sub Command1_Click()
If Text1.Text = "" Then
Label1.Caption = ""
ElseIf Val(Text1.Text) Mod 2 = 0 Then
Label1.Caption = "GENAP"
Else
Label1.Caption = "GANJIL"
End If
Command2.Enabled = True
Command1.Enabled = False
End Sub

Private Sub Command2_Click()
Text1.Text = ""
Label1.Caption = ""
Command1.Enabled = True
Command2.Caption = False
Text1.SetFocus
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub

Rabu, 07 April 2010

Bilangan Prima














Coding Program Prima

Private Sub cmd_proses_Click()

If Val(Text1.Text) = 1 Then

Text2.Text = "Bukan Prima"

ElseIf Val(Text1.Text) = 2 Then

Text2.Text = "Prima"

Else

For i = 2 To Val(Text1.Text) - 1

If Val(Text1.Text) Mod i = 0 Then

Text2.Text = "Bukan Prima"

Exit For

Else

Text2.Text = "Prima"

End If

Next

End If

cmd_proses.Enabled = False

cmd_ulang.Enabled = True

End Sub

Private Sub cmd_ulang_Click()

Text1.Text = ""

Text2.Text = ""

cmd_proses.Enabled = True

cmd_ulang.Caption = False

Text1.SetFocus

End Sub

Private Sub cmd_keluar_Click()

Unload Me

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii >= 65 And KeyAscii <= 90 Or KeyAscii >= 97 And KeyAscii <= 122 Then

KeyAscii = 0

KeyAscii = 0

End If

If KeyAscii = 13 Then

cmd_proses.SetFocus

End If

End Sub

Selasa, 06 April 2010

Bujur Sangkar

















Coding Program Bujur Sangkar

Private Sub txt_out_Change()

txt_out.Enabled = False

End Sub

Private Sub cmd_ulang_Click()

txt_in.Text = ""

txt_out.Text = ""

opt_luas.Value = True

txt_in.SetFocus

End Sub

Private Sub cmd_keluar_Click()

Unload Me

End Sub

Private Sub txt_in_KeyPress(KeyAscii As Integer)

If KeyAscii >= 65 And KeyAscii <= 90 Or KeyAscii >= 97 And KeyAscii <= 122 Then

KeyAscii = 0


Else

End If

End Sub

Sub rumus()

If opt_luas.Value = True Then

lbl_in.Caption = "Sisi"

txt_out.Text = Val(txt_in.Text) * Val(txt_in.Text)

ElseIf opt_sisi.Value = True Then

lbl_in.Caption = "Luas"

txt_out.Text = Sqr(Val(txt_in.Text))

End If

End Sub

Private Sub txt_out_Change()

txt_out.Enabled = False

End Sub





Minggu, 04 April 2010

Pemrograman Matematika

Untuk saat ini belum tersedia apa-apa...
tunggu saja besok....
hehehehe.....