Anggota Kelompok :
1. Anak Agung Aryasatya Daniswara (19051204050)
2. Gemma Dwi Prasetya (19051204051)
1.4 Tujuan
Adapun tujuan dari pembuatan projek Program Penjualan Hp ini, yaitu :
a) Mempermudah pemilihan barang pembelian.
b) Mempermudah dan mempercepat proses pembelanjaan.
BAB II
PEMBAHASAN
Setelah menginput nomial, maka program akan selesai dan muncul pilihan seperti di atas
2.4 Proses Pembuatan Program Penjualan Hp
a) Yang paling utama adalah menentukan apa saja program yang ingin dibuat dalam
program nantinya.
b) Pastikan semua alat dan bahan sudah siap pakai (sudah terinstall).
c) Hidupkan laptop, lalu buka aplikasi C ++
void judul();
void garis();
long total(long harga, long jml_beli);
long kembali(long u_bayar, long tobay);
struct data //Struct atau record adalah kumpulan data yang memiliki tipe data yang
berbeda
{
char merk_hp[10], kd_hp[2], tipe_hp[15];
int kd_tipe, jml_beli, harga;
long tohar;
};
data tipe[30];
subtotal=0;
system("cls");
garis();
judul();
garis();
cout<<endl;
cout<<"\nNama Pembeli : "; getline(cin,nama);
ulangi1:
cout<<"Pilihan "<<endl;
cout<<"1. Beli HP"<<endl;
cout<<"2. Bayar"<<endl;
cout<<"Masukkan pilihan : "; cin>>pilihan;
switch(pilihan){
case 1:
cout<<"\nJumlah Data
Barang Dibeli : "; cin>>j;
cout<<endl;
awal:
for(i=1;i<=j;i++)
//>>>>>>>>>>>>>>>>PERULANGAN UNTUK KONDISI>>>>>>>>>>>>>>>
{
cout<<"Data ke -
"<<i<<endl;
cout<<"Kode Merek HP
[SA/IP] : "; cin>>tipe[i].kd_hp; cout<<endl;
if(tipe[i].merk_hp!="SA" ||
tipe[i].merk_hp!="IP"){
if(strcmp(tipe[i].kd_hp,"SA")==0) // strcmp untuk membandingkan dua buah
string
{
strcpy(tipe[i].merk_hp,
"SAMSUNG");
ulangi:
cout<<"List:\n1.Galaxy
S5\n2.Galaxy Note 4\n3.Galaxy S6 edge\nPilih[1-3] : "; cin>>tipe[i].kd_tipe;
cout<<endl;
if(tipe[i].kd_tipe==1)
{
strcpy(tipe[i].tipe_hp,
"Galaxy S5"); //strcpy untuk menyalin string
tipe[i].harga=5000000;
goto sini;
}
else
if(tipe[i].kd_tipe==2)
{
strcpy(tipe[i].tipe_hp,
"Galaxy Note 4");
tipe[i].harga=10000000;
goto sini;
}
else
if(tipe[i].kd_tipe==3)
{
strcpy(tipe[i].tipe_hp,
"Galaxy S6 edge");
tipe[i].harga=14000000;
goto sini;
} else {
cout << "Kode Salah
Ulangi lagi?(Y/N) : ";
cin >> lagi;
if(lagi=='Y'||lagi=='y'){
cout << endl;
goto ulangi;
}else{
goto
akhir;
}
}
}
else
if(strcmp(tipe[i].kd_hp,"IP")==0)
{
strcpy(tipe[i].merk_hp,
"IPHONE");
cout<<"List:\n1.Iphone
4\n2.Iphone 5\n3.Iphone 6\nPilih[1-3] : "; cin>>tipe[i].kd_tipe; cout<<endl;
if(tipe[i].kd_tipe==1)
{
strcpy(tipe[i].tipe_hp,
"Iphone 4");
tipe[i].harga=4500000;
goto sini;
}
else
if(tipe[i].kd_tipe==2)
{
strcpy(tipe[i].tipe_hp,
"Iphone 5");
tipe[i].harga=6500000;
goto sini;
}
else
if(tipe[i].kd_tipe==3)
{
strcpy(tipe[i].tipe_hp,
"Iphone 6");
tipe[i].harga=12000000;
goto sini;
} else {
cout << "Kode Salah
Ulangi lagi?(Y/N) : ";
cin >> lagi;
if(lagi=='Y'||lagi=='y'){
cout << endl;
goto ulangi;
}else{
goto
akhir;
}
}
}
cout << "Kode Salah
Ulangi lagi?(Y/N) : ";
cin >> lagi;
if(lagi=='Y'||lagi=='y'){
cout << endl;
goto awal;
}else{
goto akhir;
}
sini:
cout<<"Jumlah Beli
: "; cin>>tipe[i].jml_beli;
cout<<endl;
case 2:
struk:
if(cek==true){
system("cls");
garis();
judul();
garis();
cout<<endl;
cout<<"\nNama Pembeli: "<<
nama;
cout<<endl<<endl;
garis();
cout<<"NO Merk Tipe
Harga Jumlah Total"<<endl;
cout<<" HP HP Satuan
Beli Harga"<<endl;
garis();
for(i=1;i<=j;i++)
//>>>>>>>>>>>>>>>>PENGULANGAN MENCETAK
OUTPUT>>>>>>>>>>>>>>>
{
cout<<setiosflags(ios::left)<<setw(4)<<i; //setiosflags = mengatur perataan
sebelah kiri
cout<<setiosflags(ios::left)<<setw(17)<<tipe[i].tipe_hp;
cout<<setiosflags(ios::left)<<setw(13)<<tipe[i].harga;
cout<<setiosflags(ios::left)<<setw(8)<<tipe[i].jml_beli;
cout<<setiosflags(ios::left)<<setw(2)<<tipe[i].tohar<<endl;
subtotal=subtotal+tipe[i].tohar;
}
garis();
cout<<" Subtotal
:Rp. "<<subtotal<<endl;
if (subtotal>=20000000){
diskon=0.08*subtotal;
}
else if (subtotal>=10000000){
diskon=0.05*subtotal;
}
else {
diskon=0;
}
cout<<" Diskon
:Rp. "<<diskon<<endl;
tobay=subtotal-diskon;
cout<<" Total
Bayar :Rp. "<<tobay<<endl;
cout<<" Uang
Bayar :Rp. "; cin>>u_bayar;
u_kembali=kembali(u_bayar,
tobay); //memanggil fungsi uang kembali
cout<<" Uang
Kembali :Rp. "<<u_kembali;
cout<<endl<<endl;
goto akhir;
} else {
cout << "Belum beli jadi apa yang
bisa di bayar " << endl;
}
break;
default:
cout << "PILIHAN SALAH"
<< endl;
break;
akhir:
garis();
cout<<"\t\t\t\t TERIMA KASIH "<<endl;
garis();
getch();
void judul ()
{
cout<<" ARYA CELL"<<endl;
}
void garis ()
{
cout<<"====================================================
========================="<<endl;
}
long total(long harga, long jml_beli)
{
return (harga*jml_beli);
}