Program Kasir Dengan Menggunakan Bahasa C++

Membuat Program Kasir Toko Alat Musik dengan menggunakan Bahasa pemrograman c++ dan berikut listing programnya :

#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;

int main()
{
int am,brand,banyak_pembelian,pembayaran,harga_am
float pajak,diskon;
float total_harga_awal, total_harga_akhir;

diskon = 0;
total_harga_awal = 0;
total_harga_akhir = 0;

 

cout << “——————————————\n”;
cout << “\t    ***Toko Alat Musik***\n”;
cout << “——————————————\n”;
cout << “Brand\n”;
cout << ” 1.  Yamaha\n”;
cout << ” 2.  Lakewood\n”;
cout << ” 3.  Ibanez\n”;
cout << ” 4.  Fender\n”;
cout << ” 5.  Gibson\n”;
cout << ” 6.  Pearl\n”;
cout << ” 7.  Taylor\n”;
cout << ” 8.  Zildjian\n”;
cout << ” 9.  Roland\n”;
cout << ” 10. Sonor\n”;
cout << “——————————————\n”;
cout << ” Pilih Brand : “; cin >> brand;
if(brand==1)
{
cout<<”  1. Gitar Akustik (Nylon)\n “;
cout<<” 2. Gitar Akustik (String, Electric) 1\n “;
cout<<” 3. Gitar Akustik (String, Electric) 2\n “;
cout<<” 4. Gitar Electric 1\n”;
cout<<”  5. Gitar Electric 2\n”;
cout<<”  6. Gitar Electric 3\n”;
cout<<”  7. Gitar Bass (Electric)\n “;
cout<<” 8. Gitar Bass (Akustik)\n “;
cout<<” 9. Drum Set 1\n”;
cout<<” 10. Drum Set 2\n”;
cout<<” 11. Cajon\n”;
cout<<” Pilih Alat Musik : “; cin>>am;
if (am=1)
harga_am = 3560000;
else if (am==2)
harga_am = 4200000;
else if (am==3)
harga_am = 4500000;
else if (am==4)
harga_am = 5000000;
else if (am==5)
harga_am = 5500000;
else if (am==6)
harga_am = 5800000;
else if (am==7)
harga_am = 6200000;
else if (am==8)
harga_am = 5500000;
else if (am==9)
harga_am = 5800000;
else if (am==10)
harga_am = 6000000;
else if (am==11)
harga_am = 3000000;
}

if(brand==2)
{
cout<<”  1. Gitar Akustik (String)\n “;
cout<<”  2. Gitar Akustik (String)\n “;
cout<<”  3. Gitar Akustik (String, Electric) 1\n “;
cout<<”  4. Gitar Akustik (String, Electric) 2\n “;
cout<<”  5. Gitar Akustik (Nylon)\n “;
cout<<”  6. Gitar Bass (Electric)\n “;
cout<<”  7. Gitar Bass (Akustik)\n “;
cout<<” Pilih Alat Musik : “; cin>>am;
if (am==1)
harga_am = 3500000;
else if (am==2)
harga_am = 3800000;
else if (am==3)
harga_am = 4200000;
else if (am==4)
harga_am = 4500000;
else if (am==5)
harga_am = 1500000;
else if (am==6)
harga_am = 4000000;
else if (am==7)
harga_am = 2000000;
}

if(brand==3)
{
cout<<”  1. Gitar Akustik (String)\n “;
cout<<” 2. Gitar Akustik (String, Electric)\n “;
cout<<” 3. Gitar Electric 1\n”;
cout<<”  4. Gitar Electric 2\n”;
cout<<”  5. Gitar Bass (Electric)\n “;
cout<<” 6. Gitar Bass (Akustik)\n “;
cout<<” Pilih Alat Musik : “; cin>>am;
if (am==1)
harga_am = 3560000;
else if (am==2)
harga_am = 2500000;
else if (am==3)
harga_am = 4500000;
else if (am==4)
harga_am = 5000000;
else if (am==5)
harga_am = 5500000;
else if (am==6)
harga_am = 2500000;
}

if(brand==4)
{
cout<<”  1. Gitar Akustik (String)\n “;
cout<<” 2. Gitar Akustik (String,Electric)\n”;
cout<<”  3. Gitar Akustik (Nylon)\n “;
cout<<” 4. Gitar Electric 1\n”;
cout<<”  5. Gitar Electric 2\n”;
cout<<”  6. Gitar Bass (Electric)\n “;
cout<<” 7. Gitar Bass (Akustik)\n “;
cout<<” Pilih Alat Musik : “; cin>>am;
if (am==1)
harga_am = 3500000;
else if (am==2)
harga_am = 4500000;
else if (am==3)
harga_am = 1600000;
else if (am==4)
harga_am = 4500000;
else if (am==5)
harga_am = 4800000;
else if (am==6)
harga_am = 5500000;
else if (am==7)
harga_am = 3500000;
}

if(brand==5)
{
cout<<”  1. Gitar Akustik (String)\n “;
cout<<” 2. Gitar Akustik (String, Electic)\n”;
cout<<”  3. Gitar Akustik (Nylon)\n “;
cout<<” 4. Gitar Electric\n”;
cout<<”  5. Gitar Bass (Electric)\n “;
cout<<” 6. Gitar Bass (Akustik)\n “;
cout<<” Pilih Alat Musik : “; cin>>am;
if (am==1)
harga_am = 4500000;
else if (am==2)
harga_am = 4800000;
else if (am==3)
harga_am = 2400000;
else if (am==4)
harga_am = 5000000;
else if (am==5)
harga_am = 5500000;
else if (am==6)
harga_am = 4200000;
}

if(brand==6)
{
cout<<”  1. Drum Set Type 1\n “;
cout<<” 2. Drum Set Type 2\n “;
cout<<” 3. Snare Drum 1\n “;
cout<<” 4. Snare Drum 2\n “;
cout<<” 5. Cymbals Set 1\n”;
cout<<”  6. Cymbals Set 2\n”;
cout<<”  7. Cajon\n”;
cout<<” Pilih Alat Musik : “; cin>>am;
if (am==1)
harga_am = 4600000;
else if (am==2)
harga_am = 5000000;
else if (am==3)
harga_am = 3000000;
else if (am==4)
harga_am = 3800000;
else if (am==5)
harga_am = 2000000;
else if (am==6)
harga_am = 1000000;
}

if(brand==7)
{
cout<<”  1. Gitar Akustik (String)\n “;
cout<<” 2. gitar Akustik (String,Electric)”;
cout<<” 3. Gitar Akustik (Nylon)\n “;
cout<<” 4. Gitar Bass (Electric)\n “;
cout<<” 5. Gitar Bass (Akustik)\n “;
cout<<” Pilih Alat Musik : “; cin>>am;
switch(am)
{
case 1:harga_am=8500000;
break;
case 2:harga_am=9000000;
break;
case 3:harga_am=5500000;
break;
default:harga_am=4000000;
}
}

if(brand==8)
{
cout<<”  1. Drum Set Type 1\n “;
cout<<” 2. Drum Set Type 2\n “;
cout<<” 3. Cymbals Set\n “;
cout<<” 4. Snare Drum\n “;
cout<<” Pilih Alat Musik : “; cin>>am;
switch(am)
{
case 1:harga_am=5000000;
break;
case 2:harga_am=5500000;
break;
case 3:harga_am=1500000;
break;
default:harga_am=2500000;
}
}

if(brand==9)
{
cout<<”  1. Keyboard (Piano)\n “;
cout<<” 2. Gitar (Bass)\n “;
cout<<” 3. Drum Set\n “;
cout<<” 4. Cajon\n “;
cout<<” Pilih Alat Musik : “; cin>>am;
switch(am)
{
case 1:harga_am=7000000;
break;
case 2:harga_am=5500000;
break;
case 3:harga_am=6000000;
break;
default:harga_am=1500000;
}
}

if(brand==10)
{
cout<<”  1. Drum Set Type 1\n “;
cout<<” 2. Drum Set Type 2\n “;
cout<<” 3. Drum Set Type 3\n “;
cout<<” 4. Cajon\n “;
cout<<” Pilih Alat Musik : “; cin>>am;
switch(am)
{
case 1:harga_am=5000000;
break;
case 2:harga_am=4500000;
break;
case 3:harga_am=5500000;
break;
default:harga_am=1500000;
}
}

cout << “\n”;
cout << “Masukan Banyak Pembelian : “; cin >> banyak_pembelian;
cout << endl<<“Pilihan Pembayaran”<< endl;
cout << “——————————————\n”;
cout << “1. Cast\n”;
cout << “2. Debit\n”;
cout << “——————————————\n”;
cout << “Pilih Pembayaran : “; cin >> pembayaran;

system(“cls”);

total_harga_awal =
(harga_am*banyak_pembelian);
if(pembayaran==1)
{
pajak =0.1*total_harga_awal;
diskon=0;
}

else if(pembayaran==2)
{
diskon=total_harga_awal*0.2;
pajak =0.1*total_harga_awal;
}
else
{
cout<< “pilihan yang anda masukan salah”<<endl;
goto bawah;
}
total_harga_akhir = (total_harga_awal+pajak)-diskon;
//output
cout << setiosflags((ios::fixed));
cout << “\tHasil Perhitungan Pengeluaran\n”;
cout << “——————————————\n”;
cout << “Pajak \t\t\t : Rp.”<<setprecision(2)
<<setw(10)<<pajak<<“\n”;
cout << “Total Harga \t\t : Rp.”<<setprecision(2)
<<setw(10)
< cout << “Diskon \t\t\t : Rp.”<<setprecision(2)
<<setw(10)<<diskon<<“\n”;
cout << “Total pembayaran \t : Rp.”
<<total_harga_akhir<<“\n”;
cout << “——————————————\n”;
bawah:
return 0;
}

dan ini hasil outputnya :

program-gitar

baik sekian semoga ini bermanfaat dan terima kasih

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s