#include<iostream.h>
#include<cstdlib>
class bakery
{
public :
int kode,jum;
long int hrg,tothrg,disk,totdisk;
void tampilan_awal()
{
cout<<"***CAFE BAKERY***"<<endl;
cout<<" 1. Bolu Gulung "<<endl;
cout<<" 2. Roti Keju "<<endl;
cout<<" 3. Mini Pizza "<<endl;
}
void input()
{
cout<<"Input kode Bakery : ";cin>>kode;
switch (kode)
{
case 1:cout<<"Bakery : Bolu Gulung "<<endl;
hrg=3300;
cout<<"Harga Bakery : "<<hrg<<endl;
cout<<"Jumlah Bakery : ";cin>>jum;
tothrg=hrg*jum;
cout<<"Total Harga : "<<tothrg<<endl;
if(jum>4)
{
disk=tothrg*10/100;
cout<<"Diskon : "<<disk<<endl;
totdisk=tothrg-disk;
cout<<"Total Harga diskon : "<<totdisk<<endl;
}
if(jum>=10)
{
cout<<"GRATIS 1 BOLU GULUNG "<<endl;
}
break;
case 2:cout<<"Bakery : Roti Keju "<<endl;
hrg=4400;
cout<<"Harga Bakery : "<<hrg<<endl;
cout<<"Jumlah Bakery : ";cin>>jum;
tothrg=hrg*jum;
cout<<"Total Harga : "<<tothrg<<endl;
if(jum>4)
{
disk=tothrg*5/100;
cout<<"Diskon : "<<disk<<endl;
totdisk=tothrg-disk;
cout<<"Total Harga diskon : "<<totdisk<<endl;
}
if(jum>=10)
{
cout<<"GRATIS 1 ROTI KEJU "<<endl;
}
break;
case 3:cout<<"Bakery : Mini Pizza "<<endl;
hrg=5500;
cout<<"Harga Bakery : "<<hrg<<endl;
cout<<"Jumlah Bakery : ";cin>>jum;
tothrg=hrg*jum;
cout<<"Total Harga : "<<tothrg<<endl;
if(jum>4)
{
disk=tothrg*10/100;
cout<<"Diskon : "<<disk<<endl;
totdisk=tothrg-disk;
cout<<"Total Harga diskon : "<<totdisk<<endl;
}
if(jum>=10)
{
cout<<"GRATIS MINI PIZZA "<<endl;
}
break;
}
}
};
int main()
{
char ulang;
ulang='y';
while((ulang=='Y') || (ulang=='y'))
{
system("cls");
bakery cafe;
cafe.tampilan_awal();
cafe.input();
cout<<"Ingin Mengulang ? : ";cin>>ulang;
}
return 0;
}
Rabu, 13 April 2011
contoh program class c++ bakery
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar