program rumus rumus bangun datar · pdf fileprogram ini berisi beberapa operasi hitung bangun...
TRANSCRIPT
Program Rumus – rumus Bangun Datar
BAB I
1.1 PENDAHULUAN
Microsoft Visual Basic (sering disingkat sebagai VB saja) merupakan sebuah bahasa pemrograman
yang menawarkan Integrated Development Environment (IDE) visual untuk membuat program perangkat lunak
berbasis sistem operasi Microsoft Windows dengan menggunakan model pemrograman (COM).
perangkat lunak komputer berbasis grafik dengan cepat.
Beberapa bahasa skrip seperti Visual Basic for Applications (VBA) dan Visual Basic Scripting Edition (VBScript),
mirip seperti halnya Visual Basic, tetapi cara kerjanya yang berbeda.
Para programmer dapat membangun aplikasi dengan menggunakan komponen-komponen yang disediakan
oleh Microsoft Visual Basic Program-program yang ditulis dengan Visual Basic juga dapat
menggunakan Windows API, tapi membutuhkan deklarasi fungsi luar tambahan.
Dalam pemrograman untuk bisnis, Visual Basic memiliki pangsa pasar yang sangat luas. Sebuah survey yang
dilakukan pada tahun 2005 menunjukkan bahwa 62% pengembang perangkat lunak dilaporkan menggunakan
berbagai bentuk Visual Basic, yang diikuti oleh C++, JavaScript, C#, dan Java.
1.2 TUJUAN
Tujuan dari program ini adalah untuk mempermudah atau mempercepat secara otomatis hasil dari opera –
operasi hitungan beberapa bangun datar yang disediakan, lebih efisien dibandingkan dengan cara manual
pastinya. Operasi yang dapat dijalankan yaitu untuk mengetahui luas dan volume dari bangun datar tersebut.
Selain tujuan diatas, program ini juga memberikan pengalaman dan ilmu kepada saya bagaimana menjalankan
ataupun membuat/menciptakan suatu program yang bermanfaat.
BAB II
2.1 INTERFACE I/0
2.1.1 Form 1
TABEL 2.1. Pengaturan property form1
No. Kontrol Property Value (Nilai)
1. Form Nama caption
Form1 Form1
2. 3. 4. 5.
Label Label Label CommandButton
Nama Caption Nama Caption Nama Caption Nama caption
Label1 SELAMAT DATANG Label2 Program ini berisi beberapa Operasi hitung bangun datar yang dapat memudahkan Anda mengetahui hasil dari perhitungan suatu bidang datar. Semoga bermanfaat Label3 SILAHKAN KLIK TOMBOL DISAMPING! Command1 MASUK
Code program form1
Private Sub Command1_click()
isi = InputBox("Masukkan nama anda terlebih dahulu ! ", "Selamat Anda telah masuk")
MsgBox "Selamat menikmati " + isi, vbOKOnly, "Terima Kasih"
If inthasil = vbOKOnly Then
Form1.Hide
Form2.Show
End If
End Sub
2.1.2 FORM2
Tabel 2.2 Pengaturan property form2
No. Kontrol Property Value ( nilai )
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14.
Form Label Frame OptionButton OptionButton OptionButton OptionButton OptionButton OptionButton OptionButton OptionButton OptionButton CommandButton CommandButton
Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption
Form2 Form2 Label1 JENIS – JENIS BANGUN DATAR Frame1 Pilih Salah Satu Option1 Persegi Option2 Persegi panjang Option3 Segitiga Option4 Jajar genjang Option5 Trapesium Option6 Lingkaran Option7 Tabung Option8 Kubus Option9 Balok Command1 Lanjutkan Command2 Selesai
Code program form2
Private Sub Command1_click()
If Option1.Value = "true" Then
Form2.Hide
Form3.Show
End If
If Option2.Value = "true" Then
Form2.Hide
Form4.Show
End If
If Option3.Value = "true" Then
Form2.Hide
Form5.Show
End If
If Option4.Value = "true" Then
Form2.Hide
Form6.Show
End If
If Option5.Value = "true" Then
Form2.Hide
Form7.Show
End If
If Option6.Value = "true" Then
Form2.Hide
Form8.Show
End If
If Option7.Value = "true" Then
Form2.Hide
Form9.Show
End If
If Option8.Value = "true" Then
Form2.Hide
Form10.Show
End If
If Option9.Value = "true" Then
Form2.Hide
Form11.Show
End If
End Sub
Private Sub command2_click()
MsgBox "Terima kasih atas kunjungan Anda !", vbkonly, "Anda telah keluar"
If inthasil = vbOKOnly Then
End
End If
End Sub
2.1.3 Form 3
Tabel 2.3 Pengaturan property form3
No. Kontrol Property Value (nilai)
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.
Form Label Label Label Label TextBox TextBox TextBox CommandButton CommandButton CommandButton
Nama Caption Nama Captio Nama Captio Nama Caption Nama Caption Nama Text Nama Text Nama Text Nama Caption Nama Caption Nama Caption
Form3 Form3 Label1 Persegi Label2 Sisi Label3 luas label4 Keliling Text1.text Kosong Text2.text Kosong Text3.text Kosong Command1 Hitung Command2 Ulang Command3 Kembali
Code program form3
Private Sub Command1_click()
Text2.Text = Text1.Text ^ 2
Text3.Text = 4 * Text1.Text
End
Private Sub command2_click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
End Sub
Private Sub command3_click()
Form3.Hide
Form2.Show
End Sub
2.1.4 Form4
Tabel 2.4 Pengaturan property Form4
No. Kontrol Property Value ( nilai )
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13.
Form Label Label Label Label Label TextBox TextBox TextBox TextBox CommandButton CommandButton CommandButton
Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Text Nama Text Nama Text Nama Text Nama Caption Nama Caption Nama Caption
Form4 Form4 Label1 Persegi panjang Label2 Panjang Label3 Lebar Label4 Luas Label5 Keliling Text1.text Kosong Text2.text Kosong Text3.text Kosong Text4.text Kosong Command1 Hitung Command2 Coba lagi Command3 Kembali
Code program form4
Private Sub Command1_click()
Text3.Text = Text1.Text * Text2.Text
Text4.Text = 2 * Text1.Text + 2 * Text2.Text
End Sub
Private Sub command2_click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
End Sub
Private Sub command3_click()
Form4.Hide
Form2.Show
End Sub
2.1.5 Form5
Tabel 2.5 Pengaturan property form6
No. Kontrol Property Value (nilai)
1. 2. 3. 4. 5. 6. 7.
Form Label Label Label Label Label Label
Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption
Form5 Form5 Label1 Segi tiga Label2 Segitiga Label3 Sisi Label4 Alas Label5 Tinggi Label6 Luas
8. 9. 10. 11. 12. 13. 14. 15. 16. 17
Label ComboBox TextBox TextBox TextBox TextBox TextBox CommandButton CommandButton CommandButton
Nama Caption Nama Text List Nama Text Nama Text Nama Text Nama Text Nama Text Nama Caption Nama Caption Nama Caption
Label7 Keliling Combo1 Jenis – jenis segi tiga Sama sisi Sama kaki Siku siku Text1.text Kosong Text2.text Kosong Text3.text Kosong Text4.text Kosong Text5.text Kosong Command1 Hitung Command2 Coba lagi Command3 Kembali
Code program form5
Private Sub Command1_click()
If Combo1.ListIndex = 1 Then
Text4.Text = 1 / 2 * Text1.Text * Text3.Text
Text5.Text = 3 * Text1.Text
End If
If Combo1.ListIndex = 2 Then
Text4.Text = 1 / 2 * Text2.Text * Text3.Text
Text5.Text = 2 * Text1.Text + Text2.Text
End If
If Combo1.ListIndex = 3 Then
Text4.Text = 1 / 2 * Text2.Text * text3text
Text5.Text = Text1.Text + Text2.Text + Text3.Text
End If
End Sub
Private Sub command2_click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
End Sub
Private Sub command3_click()
Form5.Hide
Form2.Show
End Sub
2.1.6 Form6
Tabel 2.6 Pengaturan property form6
No. Kontrol Property Value (nilai)
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.
Form Label Label Label Label TextBox TextBox TextBox CommandButton CommandButton CommandButton
Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Text Nama Text Nama Text Nama Caption Nama Caption Nama Caption
Form6 Form6 Label1 Jajar genjang Label2 Alas Label3 Tinggi Label4 Luas Text1.text kosong text2.text kosong text3.text kosong command1 kembali Command2 Hitung i Command3 Coba lagi
Code program form6
Private Sub command2_click()
Text3.Text = Text1.Text * Text2.Text
End Sub
Private Sub Command1_click()
Form6.Hide
Form2.Show
End Sub
Private Sub command3_click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
End Sub
2.1.7 Form7
Tabel 2.7 Pengaturan property form7
No. Kontrol Property Value (nilai)
1. 2. 3. 4. 5. 6. 7. 8. 9.
Form Label Label Label Label Label TextBox TextBox TextBox
Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Text Nama Text Nama Text
Form7 Form7 Label1 TRAPESIUM Label2 Sisi 1 Label3 Sisi 2 Label4 Tinggi Label5 Luas Text1.text Kosong Text2.text Kosong Text3.text Kosong
10. 11. 12. 13.
TextBox CommandButton CommandButton CommandButton
Nama Text Nama Caption Nama Caption Nama Caption
Text4.text Kosong Command1 Kembali Command2 Hitung Command3 Coba lagi
Code program form7
Private Sub Command1_click()
Form7.Hide
Form2.Show
End Sub
Private Sub command3_click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
End Sub
Private Sub command2_click()
Text4.Text = 1 / 2 * Text1.Text * Text2.Text * Text3.Text
End Sub
2.1.8 Form8
Tabel 2.8 pengaturan property form8
No. Kontrol Property Value (nilai)
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.
Form Label Label Label Labe TextBox TextBox TextBox CommandButton CommandButton CommandButton
Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Text Nama Text Nama Text Nama Caption Nama Caption Nama Caption
Form8 Form8 Label1 Lingkaran Label2 Diameter Label3 Luas Label4 Keliling Text1.text Kosong Text2.text Kosong Text3.text Kosong Command1 Hitung Command2 Coba lagi Command3 Kembali
Code program form8
Private Sub Command1_click()
Dim D As Integer
Const phi = 3.14
Text2.Text = (1 / 4 * phi * Text1.Text ^ 2)
Text3.Text = (phi * Text1.Text)
End Sub
Private Sub command2_click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
End Sub
Private Sub command3_click()
Form8.Hide
Form2.Show
End Sub
2.1.9 Form9
Tabel 2.9 pengaturan form9
No. Kontrol Property Value ( nilai )
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17.
Form Label Label Label Label Label Label Label TextBox TextBox TextBox TextBox TextBox TextBox CommandButton CommandButton CommandButton
Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Text Nama Text Nama Text Nama Text Nama Text Nama Text Nama Caption Nama Caption Nama Caption
Form9 Form9 Label1 TABUNG Label2 Jari jari Label3 Tinggi Label4 Luas alas Label5 Luas selimut Label6 Luas permukaan Label7 Valume Text1.text Kosong Text2.text Kosong Text3.text Kosong Text4.text Kosong Text5.text Kosong Text6.text Kosong Command1 Hitung Command2 Coba lagi Command3 kembali
Code program form9
Private Sub Command1_click()
Text3.Text = 3.14 * (Text1.Text ^ 2)
Text4.Text = 2 * 3.14 * Text1.Text * Text2.Text
Text5.Text = 2 * Text3.Text + Text4.Text
Text6.Text = 3.14 * (Text1.Text ^ 2) * Text2.Text
End Sub
Private Sub command2_click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
End Sub
Private Sub command3_click()
Form9.Hide
Form2.Show
End Sub
2.1.10 Form10
Tabel 2.10 Pengaturan property form10
No. Kontrol Property Value ( nilai )
1. 2. 3. 4. 5. 6.
Form Label Label Label Label TextBox
Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Text
Form10 Form10 Label1 KUBUS Label2 Sisi Label3 Luas Label4 Volume Text1.text Kosong
7. 8. 9. 10. 11.
TextBox TextBox CommandButton CommandButton CommandButton
Nama Text Nama Text Nama Caption Nama Caption Nama Caption
Text2.text Kosong Text3.text Kosong Command1 Hitung Command2 Coba lagi Command3 Kembali
Code program form10
Private Sub Command1_click()
Text2.Text = 6 * (Text1.Text ^ 2)
Text3.Text = Text1.Text ^ 3
End Sub
Private Sub command2_click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
End Sub
Private Sub command3_click()
Form10.Hide
Form2.Show
End Sub
2.1.11 Form11
Tebel 2.11 Pengaturan property form11
No. Kontrol Property Value ( nilai )
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15.
Form Label Label Label Label Label Label TextBox TextBox TextBox TextBox TextBox CommandButton CommandButton CommandButton
Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Caption Nama Text Nama Text Nama Text Nama Text Nama Text Nama Caption Nama Caption Nama Caption
Form1 Form1 Label1 BALOK Label2 Panjang Label3 Lebar Label4 Tinggi Label5 Luas Label6 Volume Text1.text Kosong Text2.text kosong text3.text kosong text4.text kosong text5.text kosong command1 hitung command2 coba lagi command3 kembali
Code program form11
Private Sub Command1_click()
Text4.Text = Text1.Text * Text2.Text * Text3.Text
Text5.Text = (2 * Text1.Text * Text2.Text) + (2 * Text2.Text * Text3.Text) + (2 * Text1.Text * Text3.Text)
End Sub
Private Sub command2_click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
End Sub
Private Sub command3_click()
Form11.Hide
Form2.Show
End Sub
2.2 PENJELASAN PROGRAM
Ketika menjalankan program ini,pertama sekali akan tampil form1 bertanda “SELAMAT DATANG”,
silahkan ketik tombol “MULAI” maka akan muncul InputBox sebagai pemberitahuan bahawa anda telah masuk
dimana user diharapkan agar memasukkan namanya,ketika tombol ok di klik maka sekali lagi akan tampil
MsgBox berupa salam dan setelah mengklik tombol ok,akan tampil form2.
Di form2 user akan disuguhkan jenis jenis bangun datar yang di sediakan di atas kontrol frame,user
akan memilih salah satu bangun datar dan mengklik tombol lanjut untuk meliihat tampilan tampilan dari
masing – masing bangun datar. jika memilih persegi maka user akan pergi ke form3 dan memulai operasi
hitungannya di form tersebut,demikian bangun bangun selanjutnya yang disusun secara berurutan kebawah
dengan form yang berurutan juga. Di form5 yaitu form untuk segi tiga akan terdapat kontrol comboBox berisi
jenis – jenis segitiga, tapi sayang sekali untuk segitiga sama sisi operasinya tidak bekerja. Di setiap form bangun
datar idisediakan beberapa tombol fungsi seperti tombol “hitung” yaitu untuk mengetahui hasil dari operasi
yang dijalankan, tombol “coba lagi” atau “ulang” untuk menghapus/mengosongkan semua textBox agar dapat
melanjutkan perhitungan yang lain dengan angka yang berbeda, dan tombol “kembali” yaitu untuk kembali ke
form2 .
Setelah selesai melakukan semua operasi hitung yang diinginkan maka user akan kembali ke form2, di
form ini selain tombol “LANJUT”, juga terdapat tombol “SELESAI”. Dengan mengklik tombol “SELESAI” berarti
user telah selesai menggunakan program ini, selanjutnya akan tampil MsgBox yang berisi pesan bahwa user
telah siap untuk keluar dari program ini.
Bab III,
3.1 KESIMPULAN
Program Visual Basic ini Adalah program yang digunakan untuk menjalankan operasi hitung dari beberapa
bangun datar yang disediakan. Program akan berjalan jika user mengikuti setiap perintah yang diminta, cukup
dengan memasukkan angka angka di setiap textBox yang diperlikan maka user akan mengetahui hasil dari
operasi yang diinginkan.
3.2 SARAN
Program ini merupakan program sederhana dari visual basic,semoga bermanfaat dan apabila ada kekurang
mohon maaf
project selanjutnya berharap dosen mengajarkan saya cara pembuatan program dengan menggunakan
bantuan data base, terima kasih