Laporan Praktikum Vb 3_1
February 18, 2018 | Author: Ambulan Zig Zag | Category: N/A
Short Description
Download Laporan Praktikum Vb 3_1...
Description
LAPORAN PRAKTIKUM BAHASA PEMOGRAMAN VISUAL
ZAIDAN HADI ( 110533430614 ) OFF F
UNIVERSITAS NEGERI MALANG FAKULTAS TEKNIK ELEKTRO PROGRAM STUDI PEND. TEKNIK INFORMATIKA SEPTEMBER, 2012
LABORATORIUM KOMPUTER Fakultas Teknik Elektro - Universitas Negeri Malang Jl.Surabaya G4 Lantai 2,Malang, Jawa Timur
FUNGSI NUMERIK
Nama
Zaidan Hadi
Nim
110533430614
Prodi
S1 Pendidikan Teknik Informatika
Dosen Pembimbing
Azhar Ahmad Tanda Tangan Laporan Percobaan(Acc,Tgl……../Bln……./Tahun……..)
Praktikum Ke 3.1 FUNGSI NUMERIK A. TUJUAN PRAKTIKUM Tujuan praktikum ini adalah : 1. Memahami mengenai penggunaan numerik. 2. Membuat program numerik sederhana menggunakan VB.
B. LATIHAN DAN HASIL LATIHAN ( SCRIPT DAN HASIL) Latihan 1 Script : Module Module2 Sub Main() Dim intValue As Integer = 123 ' Konversi implisit (konversi widening) ' dari Integer ke Long Dim longValue As Long = intValue Console.WriteLine(intValue & " = " & longValue) ' Output: 123 Console.Read() End Sub End Module
Hasil :
Latihan 2 Script : Module Module2 Sub Main()
Dim intValue As Integer = CInt(intValue) Console.WriteLine(intValue & " = " & intValue) Console.ReadKey(CInt(intValue)) End Sub End Module
Hasil :
Latihan 3 Script : Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Lbl3.Text = CStr(Math.Cos(15.5)) End Sub End Class
Hasil :
Latihan 4 Script : Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label4.Text = CStr(CDbl(TextBox1.Text) + CDbl(TextBox2.Text)) End Sub End Class
Hasil :
C. TUGAS PRAKTIKUM a) Dari seluruh fungsi matematika yang ada di atas tadi, buatlah ke dalam satu form Script : Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label4.Text = CStr(CDbl(TextBox1.Text) + CDbl(TextBox2.Text)) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Lbl3.Text = CStr(Math.Cos(15.5)) End Sub End Class
Hasil :
b) message box hasil penjumlahan 2 angka yang diinputkan melalui kode program Script : Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label4.Text = CStr(CDbl(TextBox1.Text) + CDbl(TextBox2.Text)) MessageBox.Show("Hasil = " & (Label4.Text)) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Lbl3.Text = CStr(Math.Cos(15.5)) End Sub End Class
Hasil :
c) Perkalian input dari kode program Script: Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label4.Text = CStr(CInt(25) * CDbl(45)) MessageBox.Show("Hasil = " & CInt(25) * CInt(45)) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Lbl3.Text = CStr(Math.Cos(15.5)) End Sub End Class
Hasil :
D. HASIL TUGAS RUMAH ( SCRIPT DAN HASIL) 1. Message box hasil perkalian, pembagian, pengurangan dan penambahan 2 angka yang diinputkan melalui Toolbox dalam 1 form
Script : Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = CStr(CDbl(TextBox1.Text) + CDbl(TextBox2.Text)) Label2.Text = CStr(CDbl(TextBox1.Text) CDbl(TextBox2.Text)) Label3.Text = CStr(CDbl(TextBox1.Text) * CDbl(TextBox2.Text)) Label4.Text = CStr(CDbl(TextBox1.Text) / CDbl(TextBox2.Text)) MessageBox.Show("hasil MessageBox.Show("hasil MessageBox.Show("hasil MessageBox.Show("hasil End Sub End Class
Hasil penambahan :
" " " "
& & & &
(Label1.Text)) (Label2.Text)) (Label3.Text)) (Label4.Text))
Hasil Pengurangan :
Hasil perkalian :
Hasil pembagian :
2. Message box hasil perkalian, pembagian, pengurangan dan penambahan 2 angka yang diinputkan melalui kode program dalam 1 form script : Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = CStr(CDbl(15) + CDbl(5)) Label2.Text = CStr(CDbl(15) - CDbl(5)) Label3.Text = CStr(CDbl(15) * CDbl(5)) Label4.Text = CStr(CDbl(15) / CDbl(5)) MessageBox.Show("hasil MessageBox.Show("hasil MessageBox.Show("hasil MessageBox.Show("hasil End Sub End Class
" " " "
& & & &
(Label1.Text)) (Label2.Text)) (Label3.Text)) (Label4.Text))
Hasil : Penambahan :
Pengurangan :
Perkalian
Pembagian
3. Fungsi oct, hex, sin, dan tan dalam 1 form, mulai dari angka 1-10! Script : Option Strict Off Imports System.Math Public Class Form1 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles Button2.Click Label24.Text = "sin 1 = " & Math.Sin(1 * (3.14 / 180)) Label3.Text = "sin 2 = " & Math.Sin(2 * (3.14 / 180)) Label16.Text = "sin 3 = " & Math.Sin(3 * (3.14 / 180)) Label17.Text = "sin 4 = " & Math.Sin(4 * (3.14 / 180)) Label18.Text = "sin 5 = " & Math.Sin(5 * (3.14 / 180))
Label19.Text = "sin 6 = " & Math.Sin(6 * (3.14 / 180)) Label20.Text = "sin 7 = " & Math.Sin(7 * (3.14 / 180)) Label21.Text = "sin 8 = " & Math.Sin(8 * (3.14 / 180)) Label22.Text = "sin 9 = " & Math.Sin(9 * (3.14 / 180)) Label23.Text = "sin 10 = " & Math.Sin(10 * (3.14 / 180)) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label2.Text = "oct 1 = " & Oct(1) Label15.Text = "oct 2 = " & Oct(2) Label14.Text = "oct 3 = " & Oct(3) Label13.Text = "oct 4 = " & Oct(4) Label12.Text = "oct 5 = " & Oct(5) Label11.Text = "oct 6 = " & Oct(6) Label10.Text = "oct 7 = " & Oct(7) Label9.Text = "oct 8 = " & Oct(8) Label8.Text = "oct 9 = " & Oct(9) Label7.Text = "oct 10 = " & Oct(10) End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Label33.Text = "tan 1 = " & Math.Tan(1 * (Math.PI / 180)) Label6.Text = "tan 2 = " & Math.Tan(2 * (Math.PI / 180)) Label25.Text = "tan 3 = " & Math.Tan(3 * (Math.PI / 180)) Label26.Text = "tan 4 = " & Math.Tan(4 * (Math.PI / 180)) Label27.Text = "tan 5 = " & Math.Tan(5 * (Math.PI / 180)) Label28.Text = "tan 6 = " & Math.Tan(6 * (Math.PI / 180)) Label29.Text = "tan 7 = " & Math.Tan(7 * (Math.PI / 180)) Label30.Text = "tan 8 = " & Math.Tan(8 * (Math.PI / 180)) Label31.Text = "tan 9 = " & Math.Tan(9 * (Math.PI / 180)) Label32.Text = "tan 10 = " & Math.Tan(10 * (Math.PI / 180)) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Label41.Text = "hex 1 = " & Hex(1) Label34.Text = "hex 2 = " & Hex(2) Label1.Text = "hex 3 = " & Hex(3) Label4.Text = "hex 4 = " & Hex(4) Label5.Text = "hex 5 = " & Hex(5) Label35.Text = "hex 6 = " & Hex(6) Label36.Text = "hex 7 = " & Hex(7) Label37.Text = "hex 8 = " & Hex(8) Label38.Text = "hex 9 = " & Hex(9) Label39.Text = "hex 10 = " & Hex(10) End Sub End Class
Hasil :
E. DAFTAR PUSTAKA
(http://www.scribd.com/document_downloads/direct/48577204?extension=pdf&ft=1 348188616<=1348192226&uahk=3EGiQay92D9SKdqa9Iru8Yk9p/w). diakses pada 23 September 2012
View more...
Comments