Home

Puisi

baak Gunadarma

Gunadarma

Studentsite

3/18/2010

Sekilas Tentang Penulisan Ilmiahku

pertama buat form seperti berikut :



ket :

Label1
Name = "Label1"
Text = "C :"

Label2
Name = "Label2"
Text = "Z :"

Label3
Name = "Label3"
Text = "µ :"

TextBox1
Name = "TextBox1"

TextBox2
Name = "TextBox2"

TextBox3
Name = "TextBox3"

Label4
Name = "Label4"
Text = "n :"

Label5
Name = "Label5"

Button1
Name = "Button1"
Text = "process"

TextBox4
Name = "TextBox4"


buat fungsi berikut :

Function hitpo(ByVal a1 As Double, ByVal a2 As Double, ByVal a3 As Double) As Double
' a1 = c , a2 = u, a3 = l
Dim pobawah As Double
pobawah = 0
Dim i As Integer
For i = 0 To a1 - 1 Step 1
pobawah = pobawah + (((a3 / a2) ^ i) / factorial(i))
Next i
pobawah = pobawah + (((a3 / a2) ^ a1) / (factorial(a1) * (1 - (a3 / (a1 * a2)))))
hitpo = 1 / pobawah
End Function

Function factorial(ByVal a As Integer) As Integer
If Not a = 0 Then
factorial = a
If Not (a = 1) Then
factorial = factorial * factorial(a - 1)
End If
Else
factorial = 1
End If

End Function

Function Pantrian(ByVal a1 As Double, ByVal a2 As Double, ByVal a3 As Double, ByVal a4 As Double, ByVal a5 As Double) As Double
'a1=c, a2 = u, a3 = l, a4 = n , a5 = po
If a4 <= a1 Then
Pantrian = ((a3 / a2) ^ a4) * a5 / factorial(a4)
Else
Pantrian = ((a3 / a2) ^ a4) * a5 / (factorial(a1) * (a1 ^ (a4 - a1)))
End If
End Function

Function nilaiR(ByVal a1 As Double, ByVal a2 As Double, ByVal a3 As Double) As Double
' a1 = c , a2 = u, a3 = l
nilaiR = a3 / (a1 * a2)
End Function

Function nilaiLQ(ByVal a1 As Double, ByVal a2 As Double, ByVal a3 As Double, ByVal a4 As Double, ByVal a5 As Double) As Double
'a1=c, a2 = u, a3 = l, a4 = n , a5 = po
nilaiLQ = (a5 * ((a3 / a2) ^ a1) * (a3 / (a1 * a2))) / (factorial(a1) * (1 - (a3 / (a1 * a2))) ^ 2)

End Function

Function nilaiL(ByVal a1 As Double, ByVal a2 As Double, ByVal a3 As Double) As Double
' a1 = Lq , a2 = u, a3 = l
nilaiL = a1 + (a3 / a2)
End Function

Function nilaiWQ(ByVal a1 As Double, ByVal a2 As Double) As Double
'a1= Lq , a2 = l
nilaiWQ = a1 / a2
End Function

Function nilaiW(ByVal a1 As Double, ByVal a2 As Double) As Double
' a1 = wq , a2 = u
nilaiW = a1 + (1 / a2)
End Function

lalu buat heandle button sebagai berikut :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim temp As String
Dim c, l, u, n As Double
Dim po, p, r, lq, ll, wq, w As Double
temp = TextBox1.Text
If Not IsNumeric(temp) Then
MsgBox("C must angka")
Exit Sub
End If
c = TextBox1.Text

temp = TextBox2.Text
If Not IsNumeric(temp) Then
MsgBox("µ must angka")
Exit Sub
End If
u = TextBox2.Text

temp = TextBox3.Text
If Not IsNumeric(temp) Then
MsgBox("? must angka")
Exit Sub
End If
l = TextBox3.Text

temp = TextBox4.Text
If Not IsNumeric(temp) Then
MsgBox("n must angka")
Exit Sub
End If
n = TextBox4.Text

po = hitpo(c, u, l)
p = Pantrian(c, u, l, n, po)
r = nilaiR(c, u, l)
lq = nilaiLQ(c, u, l, n, po)
ll = nilaiL(lq, u, l)
wq = nilaiWQ(lq, l)
w = nilaiW(wq, u)

Dim text As String
text = "Hasil : " & Chr(13)
text = text & "Probabilitas tidak adanya pengantri dalam sistem (Po) : " & po & Chr(13)
text = text & "Probabilitas banyaknya pengantri dalam sistem (P) : " & p & Chr(13)
text = text & "tingkat kegunaan (R) : " & r & Chr(13)
text = text & "rata-rata banyaknya pengantri dalam antrian (Lq) : " & lq & Chr(13)
text = text & "rata-rata banyaknya pengantri dalam sistem (L) : " & ll & Chr(13)
text = text & "rata waktu mengantri dalam antrian (Wq) : " & wq & Chr(13)
text = text & "rata waktu mengantri dalam antrian (W) : " & w
Label5.Text = text
End Sub



sekarang telah jadi

selamet mencoba yah..............

terimakasih untuk k'Ahmad yang telah membantu

Tidak ada komentar: