#include <iostream>
#include <conio.h>
#include <windows.h>
using namespace std;
class kasir{
int a,b;
public:
void angka (int,int);
int total (void) {return (a*b);
}
int kembalian (void) {return (a-b);
}
};
void kasir::angka (int x, int y){
a=x;
b=y;
}
struct barang {
int kode,pri,jml,byr;
};
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
kasir ksr;
barang brg1;
char lagi,nama[20];
cout<<" BURJO KANG KOMAR "<<endl;
cout<<" Anda Kenyang Kami Senang "<<endl;
cout<<"========================================="<<endl;
cout<<""<<endl;
cout<<" Menu Makanan Harga"<<endl;
cout<<"1. AYAM GORENG Rp. 10.000"<<endl;
cout<<"2. NASI GORENG Rp. 8.000"<<endl;
cout<<"3. MIE DOK DOK Rp. 10.000"<<endl;
cout<<"4. MAGELANGAN Rp. 12.000"<<endl;
cout<<"5. NASI OMELET Rp. 8.000"<<endl;
cout<<"6. ES JERUK Rp. 6.000"<<endl;
cout<<"7. ES TEH Rp. 1500"<<endl;
cout<<endl;
cout<<"MASUKKAN NAMA ANDA : ";
cin>>nama;
do
{
cout<<'\n'<<"MASUKKAN PILIHAN ANDA : ";
cin>>brg1.kode;
switch (brg1.kode){
case 1:
cout<<'\n'<<"AYAM GORENG"<<endl;
brg1.pri=10000;
cout<<"Masukkan Jumlah :";
cin>>brg1.jml;
ksr.angka(brg1.pri,brg1.jml);
cout<<"Total harganya yaitu : Rp. "<<ksr.total()<<endl;
cout<<"DIBAYAR : Rp. ";
cin>>brg1.byr;
ksr.angka(brg1.byr,ksr.total());
cout<<"KEMBALI : Rp. "<<ksr.kembalian()<<endl;
cout<<"Masih ada Y/T :";
cin>>lagi;
break;
case 2:
cout<<'\n'<<"NASI GORENG"<<endl;
brg1.pri=8000;
cout<<"Masukkan Jumlah :";
cin>>brg1.jml;
ksr.angka(brg1.pri,brg1.jml);
cout<<"Total harganya yaitu : Rp. "<<ksr.total()<<endl;
cout<<"DIBAYAR : Rp. ";
cin>>brg1.byr;
ksr.angka(brg1.byr,ksr.total());
cout<<"KEMBALI : Rp. "<<ksr.kembalian()<<endl;
cout<<"Masih ada Y/T :";
cin>>lagi;
break;
case 3:
cout<<'\n'<<"MIE DOK DOK"<<endl;
brg1.pri=10000;
cout<<"Masukkan Jumlah :";
cin>>brg1.jml;
ksr.angka(brg1.pri,brg1.jml);
cout<<"Total harganya yaitu : Rp. "<<ksr.total()<<endl;
cout<<"DIBAYAR : Rp. ";
cin>>brg1.byr;
ksr.angka(brg1.byr,ksr.total());
cout<<"KEMBALI : Rp. "<<ksr.kembalian()<<endl;
cout<<"Masih ada Y/T :";
cin>>lagi;
break;
case 4:
cout<<'\n'<<"MAGELANGAN"<<endl;
brg1.pri=12000;
cout<<"Masukkan Jumlah :";
cin>>brg1.jml;
ksr.angka(brg1.pri,brg1.jml);
cout<<"Total harganya yaitu : Rp. "<<ksr.total()<<endl;
cout<<"DIBAYAR : Rp. ";
cin>>brg1.byr;
ksr.angka(brg1.byr,ksr.total());
cout<<"KEMBALI : Rp. "<<ksr.kembalian()<<endl;
cout<<"Masih ada Y/T :";
cin>>lagi;
break;
case 5:
cout<<'\n'<<"NASI OMELET"<<endl;
brg1.pri=8000;
cout<<"Masukkan Jumlah :";
cin>>brg1.jml;
ksr.angka(brg1.pri,brg1.jml);
cout<<"Total harganya yaitu : Rp. "<<ksr.total()<<endl;
cout<<"DIBAYAR : Rp. ";
cin>>brg1.byr;
ksr.angka(brg1.byr,ksr.total());
cout<<"KEMBALI : Rp. "<<ksr.kembalian()<<endl;
cout<<"Masih ada Y/T :";
cin>>lagi;
break;
case 6:
cout<<'\n'<<"ES JERUK"<<endl;
brg1.pri=2000;
cout<<"Masukkan Jumlah :";
cin>>brg1.jml;
ksr.angka(brg1.pri,brg1.jml);
cout<<"Total harganya yaitu : Rp. "<<ksr.total()<<endl;
cout<<"DIBAYAR : Rp. ";
cin>>brg1.byr;
ksr.angka(brg1.byr,ksr.total());
cout<<"KEMBALI : Rp. "<<ksr.kembalian()<<endl;
cout<<"Masih ada Y/T :";
cin>>lagi;
break;
case 7:
cout<<'\n'<<"ES TEH"<<endl;
brg1.pri=1500;
cout<<"Masukkan Jumlah :";
cin>>brg1.jml;
ksr.angka(brg1.pri,brg1.jml);
cout<<"Total harganya yaitu : Rp. "<<ksr.total()<<endl;
cout<<"DIBAYAR : Rp. ";
cin>>brg1.byr;
ksr.angka(brg1.byr,ksr.total());
cout<<"KEMBALI : Rp. "<<ksr.kembalian()<<endl;
cout<<"Masih ada Y/T :";
cin>>lagi;
break;
default:
cout<<"Kode yang anda masukkan tidak ada";
}
}
while (lagi=='Y' || lagi=='y');
cout<<"Terimah Kasih "<<nama<<" Atas Kunjungan Anda di BURJO KANG KOMAR";
getch ();
}
Dan Hasilnya.........
Selamat Mencoba
0 komentar:
Posting Komentar