Dalam pembuatan program pasti ada namanya kode program dalam makalah ini penulis membuat program tentang kasir rumah makan, dan kodenya sebagai berikut :
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
/*TUGAS UAS MATA KULIAH PEMROGRAMAN C++.
Nama :Sahrul Gunawan
Nim : 130403010045
Fak/Prodi : FTI/TI
Web : http://sahrul-ti.blogspot.com
MEMBUAT PROJECT KASIR SEDERHANA MENGGUNAKAN TURBO C++ */
main()
{
char *nm_mkn, *nm_mnm, kd_paket, pilihan2, nampel[10];
float jum_bel, harga, bayar, kembalian, total, ppn, diskon, tobay;
awal:
clrscr();
cout << " RESTO CITA RASA \n";
cout << " ALA MADURA \n";
cout<<endl;
cout << "--------------------------------------------------------------\n";
cout << "|Paket| MENU MAKANAN | MENU MUNUMAN | HARGA |\n";
cout << "--------------------------------------------------------------\n";
cout << " | A | Nasi Guling | Jus Alpukat | RP. 20.000 |\n";
cout << " | B | Mie Ayam | Extrajoss | Rp. 15.000 |\n";
cout << " | C | Nasi Goreng | Es Jeruk | RP. 15.000 |\n";
cout << " | D | Nasi Campur | Jus sirsak | Rp. 10.000 |\n";
cout << " | E | Sate ayam | Es teh | RP. 15.000 |\n";
cout << " | F | Nasi telor | Es fanta | RP. 20.000 |\n";
cout << " | G | Nasi lalapan | Teh anget | RP. 15.000 |\n";
cout << " | H | Bakso special | Jus Mangga | RP. 15.000 |\n";
cout << "--------------------------------------------------------------\n\n";
cout << "=======================================\n";
cout << "| RESTO CITA RASA |\n";
cout << "| ALA MADURA |\n";
cout << "=======================================\n\n\n";
paket:
cout << " Nama Pelanggan : ";
cin >> nampel;
cout << " Silahkan Masukan Kode Paketnya [A/B/C/D/E/F/G/H]: ";
cin >> kd_paket;
cout << " Jumlah Beli : ";
cin >> jum_bel;
cout << "--------------------------------------------\n";
if (kd_paket=='A' || kd_paket=='a')
{
nm_mkn="Nasi Be Guling";
nm_mnm="Jus Alpukat";
harga=20000;
}
else if (kd_paket=='B' || kd_paket=='b')
{
nm_mkn="Mie Ayam";
nm_mnm="Extrajoss";
harga=15000;
}
else if (kd_paket=='C' || kd_paket=='c')
{
nm_mkn="Nasi Goreng";
nm_mnm="Es Jeruk";
harga=15000;
}
else if (kd_paket=='D' || kd_paket=='d')
{
nm_mkn="Nasi Campur";
nm_mnm="Jus sirsak";
harga=10000;
}
else if (kd_paket=='E' || kd_paket=='e')
{
nm_mkn="Sate ayam";
nm_mnm="Es teh";
harga=15000;
}
else if (kd_paket=='F' || kd_paket=='f')
{
nm_mkn="Nasi telor";
nm_mnm="Es fanta";
harga=20000;
}
else if (kd_paket=='G' || kd_paket=='g')
{
nm_mkn="Nasi lalapan";
nm_mnm="Teh anget";
harga=15000;
}
else if (kd_paket=='H' || kd_paket=='h')
{
nm_mkn="Bakso spesial";
nm_mnm="Jus mangga";
harga=15000;
}
else
{
cout << "\n[ Maaf Masukkan Paket Sesuai Pilihan di Atas, Terimaksih !!]"<<endl;
cout << "--------------------------------------------\n";
getche ();
goto paket;
}
clrscr();
cout << "=======================================\n";
cout << "| RESTO CITA RASA |\n";
cout << "| ALA MADURA |\n";
cout << "=======================================\n\n\n";
cout << "Nama Makanan : "<<nm_mkn<<"\n";
cout << "Nama Minuman : "<<nm_mnm<<"\n";
cout << "Harga : Rp "<<harga<<"\n";
cout << "_________________________________________\n";
total=jum_bel*harga;
ppn=0.0*total;
tobay=(total+ppn)-diskon;
if (jum_bel >= 3)
diskon=0.10*harga*jum_bel;
else if (jum_bel < 3)
diskon=0;
cout << "Total Harga : Rp "<<total<<"\n";
cout << "PPN : Rp "<<ppn<<"\n";
cout << "Diskon : Rp "<<diskon<<"\n";
cout << "_________________________________________\n";
bayar:
cout << "Total Bayar : Rp "<<tobay<<"\n";
cout << "Bayar : Rp ";
cin >> bayar;"\n";
if (bayar < tobay)
{
cout << "\n\n_________________________________________\n";
cout << "Maaf, Uang Anda Kurang Maz !!! (Silahkan tekan enter)"<<endl;
cout << "_________________________________________\n";
getche();
goto bayar;
}
cout << "_________________________________________\n";
kembalian=bayar-tobay;
cout << "Kembalian : Rp "<<kembalian<<"\n";
cout << endl;
cout << "=========================================\n";
cout << endl<<endl;
cout << "TERIMA KASIH ATAS KUNJUNGANNYA SAUDARA "<< nampel<<"\n";
cout << endl;
{
cout << "=========================================\n";
cout << "\nApakah ingin menghitung ulang ? [Y/N] : ";
cin >> pilihan2;
switch(pilihan2)
{
case 'Y':
case 'y' :
goto awal;
break;
case'N':
case 'n' :
clrscr();
cout << endl << endl;
cout << " SELAMAT MENIKMATI DAN SELAMAT DATANG KEMBALI\n";
cout << " -=SEE YOU GOOD BY=-";
getche();
break;
default:
cout << "Inputkan Pilihan dengan Benar !!!";
getche();
}
return 0;
}
getch();
}
- kode program setelah di kompile.
Nahh itu programnya sob, gampang kan...??? semoga brmanfaat bagi kita semua, Amiieenn...
dan jangan lupa ya joinnya + komentarnya...
ko gk bisa ng;compile ya ka.....
ReplyDelete@Novi Mulyati TPLEA: coba di cek lagi coding programnya, trus aplikasinya pakek turbo ++, terimakasih.
ReplyDelete