Nim : 3105211005
Prodi : Sistem Komputer
#include <iostream.h>
#include <conio.h>
main(){
int barang[9];
long harga[9]={0},banyak[9],jenis,j,tot[9]={0},total,pajak,bayar;
cout<<" KODE NAMA HARGA "<<endl;
cout<<"============================================"<<endl;
cout<<" 11 | Vitamin A | Rp.31000 "<<endl;
cout<<" 12 | Vitamin B | Rp.38000 "<<endl;
cout<<" 13 | Vitamin C | Rp.24000 "<<endl;
cout<<" 14 | Vitamin D | Rp.49000 "<<endl;
cout<<" 15 | Vitamin E | Rp.41000 "<<endl;
cout<<" 16 | Vitamin B Kompleks | Rp.38000 "<<endl;
cout<<" 17 | Vitamin B1 | Rp.36000 "<<endl;
cout<<" 18 | Vitamin B2 | Rp.19000 "<<endl;
cout<<"============================================"<<endl;
cout<<endl;
cout<<"Total barang yang akan dibeli : ";
cin>>jenis;
if(jenis<9){
for(int i=0;i<=jenis-1;i++){
cout<<"Masukkan kode barang yang dibeli : ";
cin>>barang[i];
cout<<"Jumlah barang yang diambil : ";
cin>>banyak[i];
}
cout<<endl<<endl;
cout<<"Total Harga"<<endl;
cout<<"============="<<endl;
for(int i=0;i<=jenis-1;i++){
j=i+1;
cout<<" "<<j<<" ) ";
switch (barang[i]){
case 11:
cout<<"Vitamin A\t\t| ";
harga[i]=31000;
break;
case 12:
cout<<"Vitamin B\t\t| ";
harga[i]=38000;
break;
case 13:
cout<<"Vitamin C\t\t| ";
harga[i]=24000;
break;
case 14:
cout<<"Vitamin D\t\t| ";
harga[i]=49000;
break;
case 15:
cout<<"Vitamin E\t\t| ";
harga[i]=41000;
break;
case 16:
cout<<"Vitamin B Kompleks\t| ";
harga[i]=38000;
break;
case 17:
cout<<"Vitamin B1\t\t| ";
harga[i]=36000;
break;
case 18:
cout<<"Vitamin B2\t\t| ";
harga[i]=19000;
break;
default:
cout<<"-\t\t\t\t| ";
harga[i]=0;
break;
}
tot[i]=banyak[i]*harga[i];
cout<<banyak[i]<<" X "<<harga[i]<<" | "<<tot[i];
cout<<endl;
}
cout<<"_______________________________________________"<<endl;
total=tot[0]+tot[1]+tot[2]+tot[3]+tot[4]+tot[5]+tot[6]+tot[7]+tot[8]+tot[9]-2;
pajak=total*0.1;
bayar=total+pajak;
cout<<"Total :Rp."<<total<<endl;
cout<<"Pajak 10% :Rp. "<<pajak<<endl;
cout<<"_______________________________________________"<<endl;
cout<<"TOTAL SETELAH PAJAK :Rp."<<bayar<<",-"<<endl;
getch();
}else{
cout<<"jenis terlalu banyak";
getch();
}}
by : Indonesian Boy
0 comments
Post a Comment