LAMPIRAN
1. Frm. Diagnosa Imports System.Math Imports pika_sistem_pakar.data Public Class frmDiagnosa Dim WithEvents diagnosa As New DB_MYSQL Dim sql = "select * from gejala order by kode asc" '//untuk menyimpan nomor pertanyaan yang sudah dipertanyakan Dim pertanyaan As Integer = 0 '//untuk menyimpan pertanyaan nilai Dim list As ListView '//variabel untuk menampung jawaban Dim dataJawaban As Integer() = Nothing Dim dataNilai As Double() = Nothing Private Sub frmDiagnosa_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load diagnosa.NamaDatabase = "pakaragne" diagnosa.NamaTabel = "gejala" Dim des() As String = {"kode", "keterangan", "nilai", "rujukan"} Dim _size() As Integer = {4, 4, 4} list = New ListView diagnosa.ListViewKu.Tambah(list, des, _size, sql) lblPertanyaan.Text = buatPertanyaan(list.Items(pertanyaan).SubItems(2).Text) ReDim Preserve dataJawaban(list.Items.Count - 1) ReDim Preserve dataNilai(list.Items.Count - 1) End Sub Function buatPertanyaan(ByVal gejala As String) As String Return "Pertanyaan Ke-" & pertanyaan + 1 & " : Apakah " & gejala & "?" End Function Enum jawaban Benar = 1 Tidak = 0 End Enum
Universitas Sumatera Utara
Sub Jawab(ByVal jwb As jawaban) If pertanyaan < list.Items.Count - 1 Then dataJawaban(pertanyaan) = jwb If jwb = jawaban.Benar Then dataNilai(pertanyaan) = Val(list.Items(pertanyaan).SubItems(3).Text.Replace(",", ".")) Else dataNilai(pertanyaan) = 0 End If pertanyaan += 1 lblPertanyaan.Text = buatPertanyaan(list.Items(pertanyaan).SubItems(2).Text) Else lblPertanyaan.Text = "Pertanyaan Sudah Selesai, silahkan lihat hasil di menu hasil!" data.isiJawaban = dataJawaban data.isiDataNilai = dataNilai End If Try Me.Text = "Jawaban pertanyaan : " & pertanyaan + 1 & "; Jawaban : " & dataJawaban(pertanyaan - 1) & ";Nilai : " & dataNilai(pertanyaan - 1) Catch ex As Exception End Try End Sub Private Sub cmdTidak_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Jawab(jawaban.Tidak) End Sub Private Sub cmdYa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Jawab(jawaban.Benar) End Sub Private Sub lblJudul_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblJudul.Click End Sub Private Sub lblPertanyaan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub
Universitas Sumatera Utara
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub Private Sub RadioButton5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton5.CheckedChanged End Sub Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged End Sub Private Sub RadioButton6_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton6.CheckedChanged End Sub Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged End Sub End Class 2. Frm. Data Gejala Public Class frmGejala Dim WithEvents gejala As New DB_MYSQL Dim sql = "select * from gejala order by kode asc" Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load gejala.NamaDatabase = "pakaragne" gejala.NamaTabel = "gejala"
Dim kolom() As String = {"Kode", "Keterangan", "Nilai", "Rujukan"} gejala.DeskripsiTAbel = kolom Dim ukuran() As Integer = {100, 1000, 100, 100}
Universitas Sumatera Utara
Dim deskripsi() As String = {"kode", "keterangan", "nilai", "rujukan"} Dim nilai() = {txtKode, txtGejala, txtNilai, txtRujukan} gejala.DeskripsiTAbel = deskripsi gejala.ObjekTabelValue = nilai gejala.ListViewKu.Tambah(Me.ListView1, kolom, ukuran, sql) gejala.TeksContainer.Tambah(cmbAlternatif, "kode", "penyakit") End Sub Private Sub cmbBaru_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBaru.Click txtGejala.Clear() txtKode.Clear() txtNilai.Clear() txtKode.Focus() txtRujukan.Clear() cmbAlternatif.Text = "" End Sub
Private Sub cmdSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSimpan.Click gejala.Aksi = DB_MYSQL.enumAksi.Simpan gejala.ListViewKu.SegarkanSemua() End Sub Private Sub cmdEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEdit.Click gejala.Aksi = DB_MYSQL.enumAksi.Edit gejala.ListViewKu.SegarkanSemua() End Sub Private Sub cmdHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdHapus.Click gejala.Aksi = DB_MYSQL.enumAksi.Hapus gejala.ListViewKu.SegarkanSemua() End Sub Private Sub cmdBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBatal.Click cmbBaru_Click(sender, e) cmdBaru.Focus()
Universitas Sumatera Utara
End Sub Private Sub cmdKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdKeluar.Click Me.Close() End Sub Private Sub gejala_Setelah_Data_Teredit(ByVal Pesan As String, ByVal isError As Boolean) Handles gejala.Setelah_Data_Teredit MsgBox(Pesan) txtGejala.Clear() txtKode.Clear() txtNilai.Clear() End Sub Private Sub gejala_Setelah_Data_Terhapus(ByVal Pesan As String, ByVal isError As Boolean) Handles gejala.Setelah_Data_Terhapus MsgBox(Pesan) txtGejala.Clear() txtKode.Clear() txtNilai.Clear() End Sub Private Sub gejala_Setelah_Data_Tersimpan(ByVal Pesan As String, ByVal isError As Boolean) Handles gejala.Setelah_Data_Tersimpan MsgBox(Pesan) txtGejala.Clear() txtKode.Clear() txtNilai.Clear() End Sub Private Sub ListView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.Click With ListView1.SelectedItems If .Count = 1 Then txtKode.Text = .Item(0).SubItems(1).Text txtGejala.Text = .Item(0).SubItems(2).Text txtNilai.Text = .Item(0).SubItems(3).Text.Replace(",", ".") txtRujukan.Text = .Item(0).SubItems(4).Text End If End With End Sub
Universitas Sumatera Utara
Private Sub cmdTambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdTambah.Click If txtRujukan.Text = "" Then txtRujukan.Text = cmbAlternatif.Text Else txtRujukan.Text &= "," & cmbAlternatif.Text End If End Sub Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged End Sub End Class
3. Frm. Hasil Public Class frmHasil Dim WithEvents sql_gejala As New DB_MYSQL Dim WithEvents sql_penyakit As New DB_MYSQL Dim sql1 As String = "select * from gejala" Dim sql2 As String = "select * from penyakit" Dim lstGejalas As ListView Dim lstPenyakit As ListView Private Sub frmHasil_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load sql_gejala.NamaDatabase = "pakaragne" sql_gejala.NamaTabel = "gejala" sql_penyakit.NamaDatabase = "pakarmata" sql_penyakit.NamaTabel = "penyakit" Dim d1 As String() = {"kode", "keterangan", "nilai", "rujukan"} Dim d2 As String() = {"kode", "keterangan", "saran"} sql_gejala.DeskripsiTAbel = d1 sql_penyakit.DeskripsiTAbel = d2 Dim u1 As Integer() = {100, 100, 100, 100} Dim u2 As Integer() = {100, 100, 100}
Universitas Sumatera Utara
lstGejalas = New ListView lstPenyakit = New ListView sql_gejala.ListViewKu.Tambah(lstGejalas, d1, u1, sql1) sql_penyakit.ListViewKu.Tambah(lstPenyakit, d2, u2, sql2) For i As Integer = 0 To 9 If Aturan(data.isiJawaban)(i) = 1 Then lblPenyakit.Text = lblPenyakit.Text & vbCrLf & i + 1 & "." & lstPenyakit.Items(i).SubItems(2).Text lblSaran.Text = lblSaran.Text & vbCrLf & i + 1 & "." & lstPenyakit.Items(i).SubItems(3).Text End If Next End Sub Function Aturan(ByVal jawaban() As Integer) As Integer() Dim hasil(9) As Integer If jawaban(0) = 1 And jawaban(1) = 1 And jawaban(2) = 1 Then hasil(0) = 1 If jawaban(3) = 1 And jawaban(4) = 1 And jawaban(5) = 1 Then hasil(1) = 1 If jawaban(4) = 1 And jawaban(5) = 1 And jawaban(6) = 1 Then hasil(2) = 1 If jawaban(7) = 1 And jawaban(8) = 1 And jawaban(9) = 1 And jawaban(10) = 1 Then hasil(3) = 1 If jawaban(11) = 1 And jawaban(12) = 1 Then hasil(4) = 1 If jawaban(13) = 1 And jawaban(14) = 1 Then hasil(5) = 1 If jawaban(15) = 1 And jawaban(16) = 1 And jawaban(17) = 1 Then hasil(6) = 1 If jawaban(18) = 1 And jawaban(19) = 1 And jawaban(20) = 1 And jawaban(21) = 1 And jawaban(22) = 1 And jawaban(23) = 1 Then hasil(7) = 1 If jawaban(24) = 1 And jawaban(25) = 1 Then hasil(8) = 1 If jawaban(26) = 1 And jawaban(27) = 1 Then hasil(9) = 1 Return hasil End Function End Class
Universitas Sumatera Utara
DAFTAR RIWAYAT HIDUP
DATA PRIBADI NAMA LENGKAP
: LENI ARDILA
NIM
: 131421016
ALAMAT
: JL. JERMAL VII NO. 24 B P.DENAI MEDAN
UMUR
: 22 Tahun
TEMPAT/TGL. LAHIR
: MEDAN, 06 AGUSTUS 1993
JENIS KELAMIN
: PEREMPUAN
AGAMA
: ISLAM
WARGA NEGARA
: INDONESIA
NO.HP
: 085261442002
EMAIL
:
[email protected]
PENDIDIKAN 1. SD ALFALAH MEDAN
TAHUN LULUS 2003
2. SMP NEGERI 2 MEDAN
TAHUN LULUS 2006
3. SMA NEGERI 8 MEDAN
TAHUN LULUS 2009
4. D3 TEKNIK INFORMATIKA FMIPA USU
TAHUN LULUS 2013
5. S1 ILMU KOMPUTER USU
TAHUN LULUS 2015
Universitas Sumatera Utara