TUGAS PROGRAM DAN APLIKASI KOMPUTER
DISUSUN OLEH :
NAMA : MEUTIA DIANI AMDI NIM : 03021181722077 KELAS : A KAMPUS : INDRALAYA
TEKNIK PERTAMBANGAN FAKULTAS TEKNIK UNIVERSITAS SRIWIJAYA
A. Program Aplikasi Rumus ABC Tampilan Awal Aplikasi
Masukkan nilai variabel a,b,c kemudian akan nilai D dan x1 dan x2. Dan juga akan muncul keterangan dari nilai D. Dimana D < 0; akar imajiner, D = 0; dua akar sama, dan D > 0; dua akar berlainan.
Akar imajiner
Dua akar berlainan
Button yang ada digunaka sesuai fungsinya. Button hapus akan menghapus semua data yang telah dimasukkan. Kemudian button keluar.
Koding Aplikasi Rumus ABC
Public Class Form1 Dim a As Double Dim b As Double Dim c As Double Dim det As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click a = TextBox1.Text b = TextBox2.Text c = TextBox3.Text TextBox5.Text = (-(b) + (Math.Sqrt((b * b) - (4 * a * c)))) / 2 * a End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click a = TextBox1.Text b = TextBox2.Text c = TextBox3.Text TextBox6.Text = (-(b) - (Math.Sqrt((b * b) - (4 * a * c)))) / 2 * a End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click a = TextBox1.Text b = TextBox2.Text c = TextBox3.Text det = (b * b) - (4 * a * c) If det > 0 Then TextBox4.Text = det
Label11.Text = "Dua akar berlainan" ElseIf det = 0 Then TextBox4.Text = det Label11.Text = "Dua akar sama" ElseIf det < 0 Then TextBox4.Text = det Label11.Text = "Akar imajiner" End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub
End Class
B. Aplikasi Matriks Tampilan awal aplikasi
Matriks Penjumlahan
Matriks Pengurangan
Matriks Perkalian
Koding Aplikasi Matriks Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If RadioButton1.Checked = True Then H1.Text = Val(A1.Text) + Val(B1.Text) H2.Text = Val(A2.Text) + Val(B2.Text) H3.Text = Val(A3.Text) + Val(B3.Text) H4.Text = Val(A4.Text) + Val(B4.Text) H5.Text = Val(A5.Text) + Val(B5.Text) H6.Text = Val(A6.Text) + Val(B6.Text) H7.Text = Val(A7.Text) + Val(B7.Text) H8.Text = Val(A8.Text) + Val(B8.Text) H9.Text = Val(A9.Text) + Val(B9.Text)
ElseIf RadioButton2.Checked = True Then H1.Text = Val(A1.Text) - Val(B1.Text) H2.Text = Val(A2.Text) - Val(B2.Text) H3.Text = Val(A3.Text) - Val(B3.Text) H4.Text = Val(A4.Text) - Val(B4.Text) H5.Text = Val(A5.Text) - Val(B5.Text) H6.Text = Val(A6.Text) - Val(B6.Text) H7.Text = Val(A7.Text) - Val(B7.Text) H8.Text = Val(A8.Text) - Val(B8.Text) H9.Text = Val(A9.Text) - Val(B9.Text)
ElseIf RadioButton3.Checked = True Then
H1.Text = Val(A1.Text) * Val(B1.Text) + Val(A2.Text) * Val(B4.Text) +
Val(A3.Text) * Val(B7.Text) H2.Text = Val(A1.Text) * Val(B2.Text) + Val(A2.Text) * Val(B5.Text) + Val(A3.Text) * Val(B8.Text) H3.Text = Val(A1.Text) * Val(B3.Text) + Val(A2.Text) * Val(B6.Text) + Val(A3.Text) * Val(B9.Text) H4.Text = Val(A4.Text) * Val(B1.Text) + Val(A5.Text) * Val(B4.Text) + Val(A6.Text) * Val(B7.Text) H5.Text = Val(A4.Text) * Val(B2.Text) + Val(A5.Text) * Val(B5.Text) + Val(A6.Text) * Val(B8.Text) H6.Text = Val(A4.Text) * Val(B3.Text) + Val(A5.Text) * Val(B6.Text) + Val(A6.Text) * Val(B9.Text) H7.Text = Val(A7.Text) * Val(B1.Text) + Val(A8.Text) * Val(B4.Text) + Val(A9.Text) * Val(B7.Text) H8.Text = Val(A7.Text) * Val(B2.Text) + Val(A8.Text) * Val(B5.Text) + Val(A9.Text) * Val(B8.Text) H9.Text = Val(A7.Text) * Val(B3.Text) + Val(A8.Text) * Val(B6.Text) + Val(A9.Text) * Val(B9.Text)
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click A1.Text = "" A2.Text = "" A3.Text = "" A4.Text = "" A5.Text = ""
A6.Text = "" A7.Text = "" A8.Text = "" A9.Text = "" B1.Text = "" B2.Text = "" B3.Text = "" B4.Text = "" B5.Text = "" B6.Text = "" B7.Text = "" B8.Text = "" B9.Text = "" H1.Text = "" H2.Text = "" H3.Text = "" H4.Text = "" H5.Text = "" H6.Text = "" H7.Text = "" H8.Text = "" H9.Text = "" End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click End End Sub
Private Sub A1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles A1.KeyPress, A2.KeyPress, A3.KeyPress, A4.KeyPress, A5.KeyPress, A6.KeyPress, A7.KeyPress, A8.KeyPress, A9.KeyPress, B1.KeyPress, B2.KeyPress, B3.KeyPress, B4.KeyPress, B5.KeyPress, B6.KeyPress, B7.KeyPress, B8.KeyPress, B9.KeyPress If IsNumeric(e.KeyChar) Or e.KeyChar = vbBack Then e.Handled = False Else e.Handled = True
End If
End Sub End Class