Rabu, 11 Maret 2015

Pertemuan 2,11 maret ,Perhitungan Nilai Akhir

1

Terdiri dari 22 ToolBox:
Object
Properties
Value
Label 1
Text
Nama
Label 2
Text
Absensi
Label 3
Text
Keaktifan
Label 4
Text
Tugas
Label 5
Text
UTS
Label 6
Text
UAS
Label 7
Text
Nilai AKhir
Label 8
Text
GRADE
Label 9
Text
Keterangan
TextBox 1
Name
txtNama
TextBox 2
Name
txtAbsensi
TextBox 3
Name
txtKeaktifan
TextBox 4
Name
txtTugas
TextBox 5
Name
txtUts
TextBox 6
Name
txtUas
TextBox 7
Name
txtNilaiAkhir
TextBox 8
Name
txtGrade
TextBox 9
Name
txtKet
Button 1
Text/Name
&Hasil/btnHasil
Button 2
Text/Name
&Clear/btnClear
Button 3
Text/Name
&Exit/btnExit
Source Code :
Public Class Form2

    Private Sub btnHasil_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHasil.Click
        Dim Nama As String
        Dim Tugas As Integer
        Dim Absensi As Integer
        Dim Keaktifan As Integer
        Dim Uts As Integer
        Dim Uas As Integer
        Dim Rata As Integer
        Dim Huruf As String
        Dim Ket As String

        Nama = txtNama.Text
        Absensi = Val(txtAbsensi.Text)
        Keaktifan = Val(txtKeaktifan.Text)
        Tugas = Val(txtTugas.Text)
        Uts = Val(txtUts.Text)
        Uas = Val(txtUas.Text)


        Rata = ((0.2 * Absensi) + (0.15 * Tugas) + (0.1 * Keaktifan) + (0.25 * Uts) + (0.3 * Uas))
        txtNilaiAkhir.Text = rata

        If Rata <= 40 Then
            Huruf = "E"
            Ket = "anda gagal"
        ElseIf Rata <= 55 Then
            Huruf = "D"
            Ket = "cukup"
        ElseIf Rata <= 66 Then
            Huruf = "C"
            Ket = "cukup"
        ElseIf Rata <= 80 Then
            Huruf = "B"
            Ket = "Baik"
        ElseIf Rata > 80 Then
            Huruf = "A"
            Ket = "Sangat Bagus"
        End If
        txtGrade.Text = huruf
        txtKet.Text = ket

    End Sub

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        txtKet.Text = ""
        txtUts.Text = ""
        txtNama.Text = ""
        txtGrade.Text = ""
        txtNilaiAkhir.Text = ""
        txtTugas.Text = ""
        txtUas.Text = ""
        txtKeaktifan.Text = ""
        txtAbsensi.Text = ""
    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Close()
    End Sub
End Class




2.      Percabangan IF dan ELSE IF

Object
Properties
Value
GroupBox 1
Text
Usia
GroupBox 2
Text
Movie
RadioButton 1
Text/Name
Usia dibawah 16 tahun/rdbDibawah
RadioButton 2
Text/Name
Usia diatas 16 tahun/rdbDiatas
CheckBox 1
Text/Name
Upin dan Ipin/chkUpin
CheckBox 2
Text/Name
Kiky si Kancil/chkKiky
CheckBox 3
Text/Name
Mahabrata/chkMahabrata
Button 1
Text/Name
&Usia/btnUsia
Button 2
Text/Name
&Keluar/btnKeluar
Button 3
Text/Name
&Movie/btnMovie

Source Code :       
Public Class ifdanelse

    Private Sub btnUsia_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUsia.Click
        If rdbDibawah.Checked = True Then

            MessageBox.Show("Kamu dibawah umur 16 Tahun!")

        ElseIf rdbDiatas.Checked = True Then

            MessageBox.Show("Kamu diatas umur 16 Tahun!")


        End If
    End Sub

    Private Sub btnMoie_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMovie.Click
        If chkUpin.Checked = True Then
            MessageBox.Show("Kamu menyukai film upin dan ipin")
        End If

        If chkKiky.Checked = True Then
            MessageBox.Show("Kamu menyukai film kiky si kancil")
        End If

        If chkMahabrata.Checked = True Then

            MessageBox.Show("Kamu menyukai film mahabrat")
        End If

    End Sub

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



Tidak ada komentar:

Posting Komentar