Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
kode.Items.Add("MB1")
kode.Items.Add("MB2")
kode.Items.Add("MB3")
kode.Items.Add("MB4")
Dim A As Integer
For A = 1 To 10 Step 1
jumlahbeli.Items.Add(A)
Next A
For A = 2001 To 2010 Step 1
tahunpembuatan.Items.Add(A)
Next A
For A = 2010 To 2020 Step 1
lamakredit.Items.Add(A)
Next
End Sub
Sub ISITABEL()
Dim isi As New ListViewItem
LV.Columns.Add("K0DE BARANG ", 80, HorizontalAlignment.Left)
LV.Columns.Add("JENIS MOBIL", 80, HorizontalAlignment.Left)
LV.Columns.Add("KONDISI MOBIL", 80, HorizontalAlignment.Left)
LV.Columns.Add("HARGA MOBIL", 80, HorizontalAlignment.Left)
LV.Columns.Add("JUMLAH", 80, HorizontalAlignment.Center)
LV.Columns.Add("TAHUN PEMBUATAN", 80, HorizontalAlignment.Center)
LV.Columns.Add("LAMA KREDIT", 80, HorizontalAlignment.Center)
LV.Columns.Add("UANG MUKA", 80, HorizontalAlignment.Center)
LV.Columns.Add("KOMISI SALES", 80, HorizontalAlignment.Center)
LV.Columns.Add("ANSURN PERBULAN", 80, HorizontalAlignment.Right)
LV.Columns.Add("TOTAL HARGA", 80, HorizontalAlignment.Right)
End Sub
Sub TABEL()
End Sub
Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
kondisi.Items.Clear()
If kondisi.Text = "MB1" Then
jenismobil.Text = "avanza"
ElseIf kode.Text = "MB2" Then
jenismobil.Text = "toyota"
ElseIf kode.Text = "MB3" Then
jenismobil.Text = "yaris"
ElseIf kode.Text = "MB4" Then
jenismobil.Text = "jezz"
End If
kondisi.Items.Add("BARU")
kondisi.Items.Add("BEKAS")
End Sub
Private Sub jumlahbeli_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jumlahbeli.SelectedIndexChanged
kondisi.Items.Clear()
kondisi.Items.Add("BARU")
kondisi.Items.Add("BEKAS")
End Sub
Private Sub kondisi_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kondisi.SelectedIndexChanged
If kondisi.Text = "BARU" And jenismobil.Text = "avanza" Then
hargamobil.Text = 5000000000
ElseIf kondisi.Text = "BEKAS" And jenismobil.Text = "avanza" Then
hargamobil.Text = 200000000
ElseIf kondisi.Text = "BARU" And jenismobil.Text = "toyota" Then
hargamobil.Text = 600000000
ElseIf kondisi.Text = "BEKAS" And jenismobil.Text = "toyota" Then
hargamobil.Text = 150000000
ElseIf kondisi.Text = "BARU" And jenismobil.Text = " yaris" Then
hargamobil.Text = 400000000
ElseIf kondisi.Text = "BEKAS" And jenismobil.Text = "yaris" Then
hargamobil.Text = 250000000
ElseIf kondisi.Text = "BERU" And jenismobil.Text = "jezz" Then
hargamobil.Text = 370000000
ElseIf kondisi.Text = "BEKAS" And jenismobil.Text = "jezz" Then
hargamobil.Text = 225000000
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PROSES.Click
jumlahbeli.Items.Clear()
If jumlahbeli.Text = "" Then
If MessageBox.Show("ISIKAN DATA", "", MessageBoxButtons.OK) Then
End If
Else
angsuranperbulan.Text = (lamakredit.Text) * (0.03 * lamakredit.Text + lamakredit.Text) / lamakredit.Text
totalharga.Text = jumlahbeli.Text * hargamobil.Text
uangmuka.Text = 0.3 * totalharga.Text
komisisales.Text = 0.2 * jumlahbeli.Text * uangmuka.Text
End If
jumlahbeli.Focus()
End Sub
Private Sub lamakredit_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lamakredit.SelectedIndexChanged
End Sub
Private Sub HAPUS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HAPUS.Click
kode.Text = ""
jenismobil.Text = ""
kondisi.Text = ""
hargamobil.Text = ""
jumlahbeli.Text = ""
tahunpembuatan.Text = ""
lamakredit.Text = ""
uangmuka.Text = ""
komisisales.Text = ""
angsuranperbulan.Text = ""
totalharga.Text = ""
End Sub
Private Sub KELUAR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KELUAR.Click
Me.Close()
End Sub
End Class
hasil:
Senin, 15 Desember 2014
Sabtu, 06 Desember 2014
contah pembuatan program memakai bahasa program c++
Sekedar iseng, daripada dibuang mending diposting dimari, siapa tahu ada yang lagi nyari contekan buat ngerjain tugas.
Berikut listing kodenya.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main()
{
char nama_kasir[15], ntransaksi[10], kode_susu, jenis_susu[15], kode_kasir[15];
float uang_bayar, jumlah_beli, harga, tharga, jharga, diskon, total_bayar, kembali;
ulang:
cout<<"-------------------------------------------"<<endl;
cout<<"\n TOKO SUSU BAYI "<<endl;
cout<<"\n -MILK COUNTER- "<<endl;
cout<<"\n==========================================="<<endl;
cout<<"Input Nomor Transaksi : ";cin>>ntransaksi;
cout<<"Input Kode Kasir [01/02/03] : ";cin>>kode_kasir;
cout<<"-------------------------------------------"<<endl;
cout<<"Pilih Kode Susu [N/L/B] : ";cin>>kode_susu;
cout<<"Input Jumlah Beli : ";cin>>jumlah_beli;
cout<<"-------------------------------------------"<<endl;
clrscr();
if (kode_susu == 'N'||kode_susu == 'n')
{
strcpy(jenis_susu,"Nutrilon Baby");
harga=125000;
}
else if (kode_susu == 'L'||kode_susu == 'l')
{
strcpy(jenis_susu,"Lactogen Baby");
harga=105000;
}
else if (kode_susu == 'B'||kode_susu == 'b')
{
strcpy(jenis_susu,"Morinaga");
harga=135000;
}
else
{
clrscr();
gotoxy(20,12);
cout<<" ANDA SALAH MEMASUKKAN KODE SUSU ";
gotoxy(20,13);
cout<<"**** TEKAN ENTER UNTUK MENGULANG *****";
getch();
clrscr();
goto ulang;
}
if (strcmp(kode_kasir, "01") == 0)
{
strcpy(nama_kasir,"Budi");
}
else if (strcmp(kode_kasir, "02") == 0)
{
strcpy(nama_kasir,"Slamet");
}
else if (strcmp(kode_kasir, "03") == 0)
{
strcpy(nama_kasir,"Paijo");
}
else
{
clrscr();
gotoxy(20,12);
cout<<" ANDA SALAH MEMASUKKAN KODE KASIR ";
gotoxy(20,13);
cout<<"**** TEKAN ENTER UNTUK MENGULANG *****";
getch();
clrscr();
goto ulang;
}
cout<<"-------------------------------------------"<<endl;
cout<<"\n TOKO SUSU BAYI "<<endl;
cout<<"\n -MILK COUNTER- "<<endl;
cout<<"\n==========================================="<<endl;
cout<<"No. Nota : "<<ntransaksi<<" "<<"Nama Kasir : "<<nama_kasir;
cout<<"\n-------------------------------------------"<<endl;
cout<<"Merk Susu : "<<jenis_susu<<endl;
cout<<"Harga : "<<harga<<endl;
cout<<"Jumlah Beli : "<<jumlah_beli<<endl;
cout<<"\n-------------------------------------------"<<endl;
tharga=harga*jumlah_beli;
diskon=0.05*tharga;
jharga=tharga-diskon;
cout<<"Jumlah Harga : "<<jharga<<endl;
cout<<"Diskon : "<<diskon<<endl;
total_bayar=jharga-diskon;
cout<<"-------------------------------------------"<<endl;
cout<<"Total Bayar : "<<total_bayar<<endl;
cout<<"Uang Bayar : ";cin>>uang_bayar;
kembali = uang_bayar - total_bayar;
cout<<"Kembali : "<<kembali<<endl;
cout<<"-------------------------------------------"<<endl;
cout<<" Terima kasih Atas Kunjungan Anda "<<endl;
getch();
}
|
Hasilnya adalah sebagai berikut :
Input
Output
Pertanyaannya, bagaimana cara memeriksa “inputan” itu benar atau salah langsung pada waktu diinput, bukan waktu akan ditampilkan?, misalkan user meng-input kode kasir dengan isian salah, misalkan 04, maka saat diinput akan langsung muncul pesan kesalahan.
Jika menggunakan kode program di atas, baru akan muncul pesan kesalahan “inputan” pada kode kasir, saat kode kasir akan ditampilkan.
Sebelumnya, terima kasih buat yang ngasih masukan.
Langganan:
Postingan (Atom)