#include<iostream>
using namespace std;
main()
{
int x,produk1=4999,produk2=10999,jumlah1,jumlah2,total,bayar,tunai,sisa,diskon;
string barang1,barang2,barang3;
cout<<“============================================”<<endl;
cout<<” Program Kasir UD Maju Mundur”<<endl;
cout<<“============================================”<<endl;
cout<<endl;
cout<<“Masukkan Nama Produk 1 : “; cin>>barang1;
cout<<“Jumlah Produk : “;
cin>>x;
jumlah1=x*produk1;
cout<<“Total Harga : Rp. “<<jumlah1<<endl;cout<<endl;
cout<<“Masukkan Nama Produk 2 : “; cin>>barang2;
cout<<“Jumlah Produk : “;
cin>>x;
jumlah2=x*produk2;
cout<<“Total Harga : Rp. “<<jumlah2<<endl;cout<<endl;
bayar=jumlah1+jumlah2;
cout<<endl;
cout<<“============================================”<<endl;
cout<<“Sub Total : Rp. “<<bayar<<endl;
if(bayar>100000)
{
diskon=0.10*bayar;
cout<<“Diskon 10%, diskon sebesar : Rp. “<<diskon<<endl;
total=bayar-diskon;
cout<<“Total : Rp. “<<total<<endl;
}
else
if(bayar<100000)
{
diskon=0;
cout<<“Diskon 0%, diskon sebesar : Rp. “<<diskon<<endl;
total=bayar;
cout<<“Total : Rp. “<<total<<endl;
}
cout<<“============================================”<<endl;
cout<<“Uang tunai : Rp. “;
cin>>tunai;
sisa=tunai-total;
cout<<“Kembalian : Rp. “<<sisa<<endl;
cout<<endl;
}
Baca Juga : Buatlah Program Dari Pseudocode penjualan barang diskon 10%
Program C++ Kasir Restoran
Berikut ini pembuatan program kasir restoran dengan menggunakan diskon 5%. Program ini memungkinkan pengguna untuk dapat memasukkan informasi berikut ini:
#include <conio.h>
#include <iostream>
using namespace std;
int main()
{
long harga, biaya, diskon, grandtotal, bayar, kembalian;
int jumlah;
char paket;
cout<<“————————-“<<endl;
cout<<” Resto Langit “<<endl;
cout<<“————————-“<<endl<<endl;
cout<<“MENU PAKET: “<<endl;
cout<<“A. Nasi Gledek + jus “<<endl;
cout<<“B. Nasi Petir + jus “<<endl;
cout<<“C. Mie Lumpur + jus “<<endl<<endl;
cout<<“Tipe Kamar [ A/B/C ]= “; cin>>paket;
cout<<“Jumlah = “; cin>>jumlah;
switch(paket)
{
case ‘A’:
case ‘a’ :
harga=28000;
break;
case ‘B’:
case ‘b’ :
harga=24000;
break;
case ‘C’:
case ‘c’ :
harga=27000;
break;
}
biaya=harga*jumlah;
diskon=0.05*biaya;
grandtotal=biaya-diskon;
cout<<“————————-“<<endl;
cout<<” WARUNG GLOBALITI “<<endl;
cout<<“————————-“<<endl<<endl;
cout<<“RINCIAN PEMBAYARAN: “<<endl;
cout<<“Menu Paket = “<<paket<<endl;
cout<<“Jumlah = “<<jumlah<<endl;
cout<<” ———— x”<<endl;
cout<<“Biaya = “<<biaya<<endl;
cout<<“Diskon 5% = “<<diskon<<endl;
cout<<” ———— -“<<endl;
cout<<“Grand Total = “<<grandtotal<<endl;
cout<<“Bayar = “; cin>>bayar; kembalian=bayar-grandtotal;
cout<<” ————–“<<endl;
cout<<“Uang Kembalian = “<<kembalian<<endl;
getch();
}
Program C++ Kasir Swalayan
Ketentuan pada program kasih ini yaitu dapat menginput data belanja berikut :
#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
int main()
{
string brg1,brg2,brg3;
int byk1,byk2,byk3,jml1,jml2,jml3,total,disc;
int jeruk=50000,nanas=3000,apel=75000;
cout <<“======================================”<< endl;
cout <<” Swalayan Buah Segar”<< endl;
cout <<“======================================”<< endl;
cout <<“1. Buah Jeruk = Rp 50.000,-“<< endl;
cout <<“2. Buah Nanas= Rp 3.000,-“<< endl;
cout <<“3. Buah Apel = Rp 75.000,-“<< endl;
cout <<“======================================”<< endl << endl;
cout <<“Input nama barang 1 : “; cin >> brg1;
cout <<“Banyak barang : “; cin >> byk1;
jml1 = byk1 * jeruk;
cout <<“Jumlah 1 : Rp. “<< jml1 << endl << endl;
cout <<“Input nama barang 2 : “; cin >> brg2;
cout <<“Banyak barang : “; cin >> byk2;
jml2 = byk2 * nanas;
cout <<“Jumlah 2 : Rp. “<< jml2 << endl << endl;
cout <<“Input nama barang 3 : “; cin >> brg3;
cout <<“Banyak barang : “; cin >> byk3;
jml3 = byk3 *apel;
cout <<“Jumlah 3 : Rp. “<< jml3 << endl << endl;
cout <<“======================================”<< endl;
total = jml1+jml2+jml3;
cout <<“Total Pembelian = Rp. “<< total << endl;
if (total > 200000)
disc = 0.1*total;
else
disc = 0;
cout <<“Discount = Rp. “<< disc << endl;
cout <<“Total Bayar = Rp. “<< total-disc << endl << endl;
cout <<“=======================================”<< endl;
cout <<” Terima kasih atas kunjungan Anda ! “<< endl;
cout <<“=======================================”<< endl;
getch();
}
Demikian ulasan tugas pembuatan contoh program c++ kasir minimarket, restoran, dan swalayan. Semoga dapat menambah wawasan teman-teman dalam menyelesaikan tugas maupun ingin mengembangkan program sederhana tersebut.