Program Penjualan GEROBAK FRIED CHIKEN
/**Latihan Bab7 no1**/
/** Created by: Ipah Hanifah **/
#include<conio.h> #include<iostream.h>
#include<stdio.h>
#include<iomanip.h>
main()
{
int i,n,bny[5];
char kd[5],jns[5][20];
int hrg[5],jumhar[5],jumbay=0,pajak[5],totbay[5];
clrscr();
cout<<"GEROBAK FRIED CHICKEN"<<endl;
cout<<"_________________________"<<endl;
cout<<"Kode Jenis Harga"<<endl;
cout<<"_________________________"<<endl;
cout<<" D Dada Rp. 6000"<<endl;
cout<<" P Paha Rp. 4500"<<endl;
cout<<" S Sayap Rp. 2000"<<endl;
cout<<"_________________________"<<endl;
cout<<"Banyak Jenis : ";cin>>n;
for (i=1;i<=n;i++)
{
cout<<"\nJenis Ke - "<<i<<endl;
cout<<"Jenis Potong [D/P/S]: ";cin>>kd[i];
cout<<"Banyak Potong : ";cin>>bny[i];
switch (kd[i])
{
case 'D': case'd':
{
strcpy(jns[i],"Dada");
hrg[i]=6000;
}
break;
case 'P': case'p':
{
strcpy(jns[i],"Paha");
hrg[i]=4500;
}
break;
case 'S': case's':
{
strcpy(jns[i],"Sayap");
hrg[i]=2000;
}
break;
default:
{
strcpy(jns[i],"Anda salah memasukkan kode");
hrg[i]=0;
}
break;
}
jumhar[i]=bny[i]*hrg[i];
cout<<endl;
}
printf("\nGEROBAK FRIED CHICKEN");
printf("\n-------------------------------------------");
printf("\nNo Jenis Harga Banyak Jumlah ");
printf("\n Potongan Satuan Beli Harga ");
printf("\n-------------------------------------------");
cout<<endl;
for(i=1;i<=n;i++)
{
cout<<i;
cout<<setiosflags(ios::left)<<" "<<jns[i];
cout<<setprecision(5)<<" "<<hrg[i];
cout<<setprecision(5)<<" "<<bny[i];
cout<<setprecision(5)<<" "<<jumhar[i]<<endl;
jumbay=jumbay+jumhar[i];
}
printf("\n-------------------------------------------");
printf("\n\t\t\tJumlah Bayar : %d",jumbay);
pajak[i]=0.1*jumbay;
totbay[i]=jumbay+pajak[i];
printf("\n\t\t\tPajak : %d",pajak[i]);
printf("\n\t\t\tJumlah Bayar : %d",jumbay);
printf("\n\t\t\tTotal Bayar : %d",totbay[i]);
getch();
}
Output:
tekan Enter maka tampilan akan seperti di bawah ini:
No comments:
Post a Comment