Source
Code:
#include<iostream.h>
#include<conio.h>
#include<string.h>
void
main()
{
int n;
int denda[10];
long total = 0;
int ID[10];
int jumlah[10];
int lama[10];
int harga;
char nama[100];
cout<<"============================="<<endl;
cout<<" RENTAL DVD HELLO KITTY"<<endl;
cout<<"============================="<<endl;
cout<<"LIST FILM"<<endl;
cout<<"1. HANTU
GENDONG"<<endl;
cout<<"2. SUSTER
NGEBUT"<<endl;
cout<<"3. SEJADAH
CINTA"<<endl;
cout<<"4. LONNEY
TOONS"<<endl;
cout<<endl;
cout<<"Nama Penyewa : ";
cin.getline(nama,100);
cout<<"Jumlah DVD yang di
sewa<Max 4> : ";
cin>>n;
for(int i = 1; i<=n; i++)
{
cout<<endl;
cout<<"Data
ke-"<<i<<" :"<<endl;
cout<<"==================="<<endl;
cout<<"Masukkan
ID Jenis Film<1-4> : ";
cin>>ID[i];
cout<<"Jumlah
Film yang di Sewa : ";
cin>>jumlah[i];
cout<<"Masukkan
Lama sewa<Hari> : ";
cin>>lama[i];
if(lama[i]>3)
{
denda[i] = 3000;
}
else
{
denda[i] =
0;
}
}
cout<<endl;
cout<<"--------------------------------------------------------------------------"<<endl;
cout<<" STRUK RENTAL DVD HELLO
KITTY"<<endl;
cout<<"-------------------------------------------------------------------------"<<endl;
cout<<"Nama
Penyewa :"<<nama<<endl;
cout<<"-----------------------------------------------------------------------"<<endl;
cout<<"No.
Nama Film \t\tHarga \t\tJumlah \tLama \tDenda \tHarga"<<endl;
cout<<"\t\t\tSewa
\t\tSewa \tSewa"<<endl;
cout<<"-----------------------------------------------------------------------"<<endl;
for(int j=1; j<=n;
j++)
{
if
(ID[j]==1)
{
harga
= 5000*jumlah[j]+denda[j];
cout<<j<<".
";
cout<<"HANTU
GENDONG \tRp. 5000,-
\t"<<jumlah[j]<<"\t"<<lama[j]<<"\t"<<denda[j]<<"\t"<<harga<<endl;
}
if
(ID[j]==2)
{
harga
= 5500*jumlah[j]+denda[j];
cout<<j<<".
";
cout<<"SUSTER
NGEBUT \tRp. 5500,- \t"<<jumlah[j]<<"\t"<<lama[j]<<"\t"<<denda[j]<<"\t"<<harga<<endl;
}
if
(ID[j]==3)
{
harga
= 6000*jumlah[j]+denda[j];
cout<<j<<".
";
cout<<"SAJADAH
CINTA \tRp. 6000,-
\t"<<jumlah[j]<<"\t"<<lama[j]<<"\t"<<denda[j]<<"\t"<<harga<<endl;
}
if
(ID[j]==4)
{
harga
= 4500*jumlah[j]+denda[j];
cout<<j<<".
";
cout<<"LONNEY
TOONS \tRp. 5500,-
\t"<<jumlah[j]<<"\t"<<lama[j]<<"\t"<<denda[j]<<"\t"<<harga<<endl;
}
total = total+harga;
cout<<"-----------------------------------------------------------------------"<<endl;
}
cout<<"\t\t\t\t\t\tTotal
Harga : \t"<<total;
getch();
}
bro ko engga bisa jalan nya program nya
BalasHapus