Program Skor Liga

| 0 comments






pertama user diminta mengisi tim dan namanya. kemudian ia harus menginput jumlah kalah menang dan seri semua tim kemudian dia akan melihat hasil perolehan skornya

Kode classnya:

Public Class class_standing
Private nama

Public Function score(ByVal win As Integer, ByVal drawmatch As Integer)
score = (win * 3) + (drawmatch * 1)
End Function

Public Property nama_lain(ByVal nama As String)
Get
nama_lain = nama
End Get
Set(ByVal value)
nama = value
End Set
End Property
End Class

kode registration :

Public Class Form1

Private Sub inpuData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles inpuData.Click
Dim exten As New class_standing

If team.Text = "" Then
MsgBox("No team is selected !", MsgBoxStyle.Information, "No Team")
ElseIf nameuser.Text = "" Then
MsgBox("No user running the program !", MsgBoxStyle.Information, "No User")
nameuser.Focus()
Else
MsgBox("Hello " & exten.nama_lain(nameuser.Text) & " ! You have selected " & exten.nama_lain(team.Text) & " as your team")
Form2.Show()
End If
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = "Registration"
End Sub
End Class

kode form input :
Public Class Form2

Private Sub AW_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AW.TextChanged
ATG.Text = Val(AW.Text) + Val(AL.Text) + Val(AD.Text)
End Sub

Private Sub AD_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AD.TextChanged
ATG.Text = Val(AW.Text) + Val(AL.Text) + Val(AD.Text)
End Sub

Private Sub AL_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AL.TextChanged
ATG.Text = Val(AW.Text) + Val(AL.Text) + Val(AD.Text)
End Sub

Private Sub CW_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CW.TextChanged
CTG.Text = Val(CW.Text) + Val(CL.Text) + Val(CD.Text)
End Sub

Private Sub CD_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CD.TextChanged
CTG.Text = Val(CW.Text) + Val(CL.Text) + Val(CD.Text)
End Sub

Private Sub CL_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CL.TextChanged
CTG.Text = Val(CW.Text) + Val(CL.Text) + Val(CD.Text)
End Sub

Private Sub LW_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LW.TextChanged
LTG.Text = Val(LW.Text) + Val(LL.Text) + Val(LD.Text)
End Sub

Private Sub LD_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LD.TextChanged
LTG.Text = Val(LW.Text) + Val(LL.Text) + Val(LD.Text)
End Sub

Private Sub LL_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LL.TextChanged
LTG.Text = Val(LW.Text) + Val(LL.Text) + Val(LD.Text)
End Sub

Private Sub MUW_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MUW.TextChanged
MUTG.Text = Val(MUD.Text) + Val(MUW.Text) + Val(MUL.Text)
End Sub

Private Sub MUD_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MUD.TextChanged
MUTG.Text = Val(MUD.Text) + Val(MUW.Text) + Val(MUL.Text)
End Sub

Private Sub MUL_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MUL.TextChanged
MUTG.Text = Val(MUD.Text) + Val(MUW.Text) + Val(MUL.Text)
End Sub

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = "Input"
Select Case Form1.team.Text
Case Is = "Arsenal"
Label1.ForeColor = Color.Cyan
Case Is = "Chelsea"
Label2.ForeColor = Color.Cyan
Case Is = "Liverpool"
Label3.ForeColor = Color.Cyan
Case Is = "Manchester United"
Label4.ForeColor = Color.Cyan
End Select
End Sub

Private Sub standing_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles standing.Click
Form3.Show()
End Sub
End Class

kode form score :

Public Class Form3

Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = "SCORE"
Dim winner As New class_standing
sc1.Text = winner.score(Form2.AW.Text, Form2.AD.Text)
sc2.Text = winner.score(Form2.CW.Text, Form2.CD.Text)
sc3.Text = winner.score(Form2.LW.Text, Form2.LD.Text)
sc4.Text = winner.score(Form2.MUW.Text, Form2.MUD.Text)
wt1.Text = Form2.AW.Text
wt2.Text = Form2.CW.Text
wt3.Text = Form2.LW.Text
wt4.Text = Form2.MUW.Text
d1.Text = Form2.AD.Text
d2.Text = Form2.CD.Text
d3.Text = Form2.LD.Text
d4.Text = Form2.MUD.Text
l1.Text = Form2.AL.Text
l2.Text = Form2.CL.Text
l3.Text = Form2.LL.Text
l4.Text = Form2.MUL.Text
End Sub

Private Sub gout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gout.Click
End
End Sub
End Class

| 0 comments




Penjelasan Program :
1.Klik Mulai untuk memulai program
2. Isi nama agar program bisa berjalan
3.Pilih Pilihan yang terdapat pada asal, tujuan, maskapai dan kelas.
4. klik buat pemesanan untuk menampilkan kode tiket, biaya, bandara

code untuk program:
Public Class Form1

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
Dim j As Integer
j = MsgBox("Anda telah dapat yang anda inginkan?", MsgBoxStyle.YesNo + MsgBoxStyle.Question, "QUIT?")

If j = vbYes Then
End
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cek.Click
Dim k As String
Dim l As String
Dim m As String

k = UCase(asal.Text)
l = UCase(tujuan.Text)
m = UCase(maskapai.Text)

Dim w As String
Dim x As String
Dim y As String
Dim z As String
Dim d As Integer

w = Microsoft.VisualBasic.Left(k, 2)
x = Microsoft.VisualBasic.Mid(l, 2, 2)
y = Microsoft.VisualBasic.Left(m, 1)

Select Case maskapai.Text
Case Is = "Garuda"
RadioButton3.Checked = True
d = " 900,000"
Case Is = "Merpati"
RadioButton2.Checked = True
d = "750,000"
Case Is = "Sriwijaya"
RadioButton1.Checked = True
d = "500,000"
Case Is = "Batavia"
d = "300,000"
Case Else
d = "250,000"
End Select

Select Case kelas.Text
Case Is = "Bisnis"
z = "0101"
d = d + "200000"
Case Is = "Ekonomi"
z = "0022"
Case Else
z = "30003"
d = d + "300000"
End Select

kode.Enabled = True
ban1.Enabled = True
ban2.Enabled = True
biaya.Enabled = True

If asal.Text = "" Then
kode.Text = ""
kode.Enabled = False
biaya.Enabled = False
ban1.Enabled = False
ban2.Enabled = False
MsgBox("Pilih asal tempat berangkat! ", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "ASAL")
Exit Sub
ElseIf tujuan.Text = "" Then
kode.Text = ""
kode.Enabled = False
biaya.Enabled = False
ban1.Enabled = False
ban2.Enabled = False
MsgBox("Pilih tujuan anda ! ", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "TUJUAN")
Exit Sub
ElseIf maskapai.Text = "" Then
kode.Text = ""
kode.Enabled = False
biaya.Enabled = False
ban1.Enabled = False
ban2.Enabled = False
MsgBox("Pilih maskapai penerbangan anda !", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "MASKAPAI")
Exit Sub
ElseIf kelas.Text = "" Then
kode.Text = ""
kode.Enabled = False
biaya.Enabled = False
ban1.Enabled = False
ban2.Enabled = False
MsgBox("Pilih kelas pesawat anda !", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "KELAS PESAWAT")
Exit Sub
ElseIf asal.Text = tujuan.Text Then
kode.Text = ""
kode.Enabled = False
biaya.Enabled = False
ban1.Enabled = False
ban2.Enabled = False
MsgBox("Jurusan dan Tujuan tak bisa sama ! ", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "TUJUAN = ASAL")
Exit Sub
End If

Select Case asal.Text
Case Is = "Bali"
ban1.Text = "Ngurah Rai"
Case Is = "Jakarta"
ban1.Text = "Soekarno-Hatta"
Case Is = "Jogjakarta"
ban1.Text = "Adi Sucipto"
Case Is = "Semarang"
ban1.Text = "Ahmad Yani"
Case Is = "Surabaya"
ban1.Text = "Juanda"
Case Is = "Medan"
ban1.Text = "polonia"
Case Is = "Manado"
ban1.Text = "Sam Ratulangi"
Case Else
ban1.Text = "Adi Sumarmo"
End Select

Select Case tujuan.Text
Case Is = "Bali"
ban2.Text = "Ngurah Rai"
Case Is = "Jakarta"
ban2.Text = "Soekarno-Hatta"
Case Is = "Jogjakarta"
ban2.Text = "Adi Sucipto"
Case Is = "Semarang"
ban2.Text = "Ahmad Yani"
Case Is = "Surabaya"
ban2.Text = "Juanda"
Case Is = "Medan"
ban2.Text = "polonia"
Case Is = "Manado"
ban2.Text = "Sam Ratulangi"
Case Else
ban2.Text = "Adi Sumarmo"
End Select

biaya.TextAlign = HorizontalAlignment.Right
kode.TextAlign = HorizontalAlignment.Center

If RadioButton1.Checked = True Then
MsgBox("Anda mendapat diskon sebesar " + RadioButton1.Text, MsgBoxStyle.Information, "DISKON 5 %")
RadioButton1.Enabled = True
RadioButton2.Enabled = False
RadioButton3.Enabled = False
biaya.Text = d - (d * 0.05)
ElseIf RadioButton2.Checked = True Then
MsgBox("Anda mendapat diskon sebesar " + RadioButton2.Text, MsgBoxStyle.Information, "DISKON 10 %")
RadioButton1.Enabled = False
RadioButton2.Enabled = True
RadioButton3.Enabled = False
biaya.Text = d - (d * 0.1)
ElseIf RadioButton3.Checked = True Then
MsgBox("Anda mendapat diskon sebesar " + RadioButton3.Text, MsgBoxStyle.Information, "DISKON 15 %")
RadioButton1.Enabled = False
RadioButton2.Enabled = False
RadioButton3.Enabled = True
biaya.Text = d - (d * 0.15)
Else
biaya.Text = d
End If

kode.Text = w + "-" + x + "-" + y + z

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mulai.Click
Me.Text = "PEMESANAN TIKET PESAWAT"

lnama.Visible = True
ganti.Visible = True
nama.Visible = True
mulai.Visible = False
asal.Visible = True
maskapai.Visible = True
tujuan.Visible = True
kelas.Visible = True
kode.Visible = True
ban1.Visible = True
ban2.Visible = True
biaya.Visible = True
RadioButton1.Visible = True
RadioButton2.Visible = True
RadioButton3.Visible = True
lasal.Visible = True
ltujuan.Visible = True
lmaskapai.Visible = True
lkelas.Visible = True
lkode.Visible = True
lban1.Visible = True
lban2.Visible = True
lbiaya.Visible = True
ldiskon.Visible = True
cek.Visible = True
keluar.Visible = True
ulang.Visible = True

MsgBox("Isi nama anda untuk memulai program ini, jika tidak, program tak akan berjalan ", MsgBoxStyle.Information, "PERINTAH AWAL")
nama.TextAlign = HorizontalAlignment.Center
nama.Text = InputBox("Nama pemesan tiket : ", "IDENTITAS")
nama.ReadOnly = True

While nama.Text = ""
MsgBox("Isi nama terlebih dahulu", MsgBoxStyle.Exclamation, "NO NAME")
nama.Text = InputBox("Nama pemesan tiket : ", "IDENTITAS")
End While

MsgBox("Harga tiap maskapai sama tiap rute penerbangan", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "INFO")
MsgBox("Jika anda memilih Garuda, diskon 15 %", MsgBoxStyle.Information, "Diskon 15%")
MsgBox("Jika anda memilih Merpati, diskon 10 %", MsgBoxStyle.Information, "Diskon 10%")
MsgBox("Jika anda memilih Sriwijaya, diskon 5 %", MsgBoxStyle.Information, "Diskon 5%")
asal.Focus()

End Sub

Private Sub ulang_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ulang.Click
asal.Text = ""
tujuan.Text = ""
maskapai.Text = ""
kelas.Text = ""
kode.Text = ""
ban1.Text = ""
ban2.Text = ""
biaya.Text = ""
RadioButton1.Checked = False
RadioButton1.Enabled = False
RadioButton2.Checked = False
RadioButton2.Enabled = False
RadioButton3.Checked = False
RadioButton3.Enabled = False
biaya.Enabled = False
kode.Enabled = False
ban1.Enabled = False
ban2.Enabled = False
End Sub

Private Sub ganti_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ganti.Click
nama.Text = InputBox("Nama anda adalah", "IDENTITAS")
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.BackColor = Color.LightSkyBlue

End Sub

Private Sub nama_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nama.TextChanged
asal.Enabled = True
tujuan.Enabled = True
maskapai.Enabled = True
kelas.Enabled = True
End Sub
End Class


Ya . segitu aja programnya