Kamis, 22 Desember 2011

penyewaan Rental DVD pada C++

SE7EN SEASON DVD RENTAL
--------------------------------------------------------------------------------------------------------------------
Tanggal                                                : <input>
Nama Penyewa                                    : <input>
-------------------------------------------------------------------------------------------------------------------
Data DVD ke-n
Judul Film                                             : <input>
Genre                                                   : <input>
Jenis
[1] New Release
[2] Recent Release
[3] Katalog
Pilih Jenis Film                                     :<input>
Lama Sewa                                         :<input>


SE7EN SEASON DVD RENTAL
--------------------------------------------------------------------------------------------------------------------
Tanggal Sewa                                    : <output>
Nama Penyewa                                 : <output>
--------------------------------------------------------------------------------------------------------------------
No            Judul Film          Genre          Jenis            Harga         Lama         Sub Total
1                 ........                 .......           ......              ......            .......           ..........
2                 ........                 .......           ......              ......            .......           ..........
---------------------------------------------------------------------------------------------------------------------
Total                         : Rp.
Potongan                  : Rp.
Jumlah                      : Rp.




1.  Buat 2 struct dengan ketentuan :
     Struct film          : Judul, Genre, Jenis, Harga, Lama, Sub Total
     Struct Penyewa  : Tanggal, Nama, dan Jumlah Sewa

2.  Harga sewa di tentukan berdasarkan jenis
     New Release            = 5000
     Recent Release         = 3000
     Katalog                    = 2000

3.  Sub Total    = Harga Sewa   X   Lama Sewa

4.  Total Bayar = Total dari Sub Total

5.  Potongan di tentukan berdasarkan jumlah DVD yang di sewa

6.  Jika Jumlah DVD yang di sewa lebih dari 5, maka akan mendapat potongan 10% dari total bayar, selain
     itu tidak mendapat potongan

7.  Jumlah bayar = Total Bayar - Potongan





jawab :

#include<conio.h>
#include<iomanip.h>
#include<stdio.h>
#include<iostream.h>
struct
{
char jdl[40],lma_sew,jml_sew,*gnr,*jns_flm;
int pot,hrg,lma,jum_bar,ttl_byr,sub_ttl;
}film;
struct
{
char napem[60],mas_jumse[70];
int tgl_sewa,nm;
}penyewa;
main()
{
char tgl_sewa[50],napem[60],mas_jumse[70];
cout<<"\t SE7EN SEASON DVD RENTAL"<<endl;
cout<<"------------------------------------------------------------"<<endl;
cout<<" Tanggal Sewa = ";cin>>penyewa.tgl_sewa;
cout<<" Nama penyewa = ";cin>>penyewa.napem;
cout<<" Masukan Jumlah Sewa = ";cin>>penyewa.mas_jumse;
cout<<"------------------------------------------------------------"<<endl;
cout<<" Data DVD ke-n"<<endl;
cout<<" Judul Film = ";cin>>film.jdl;
cout<<" Genre = ";cin>>film.gnr;
cout<<"jenis"<<endl;
cout<<"(1)New Release"<<endl;
cout<<"(2)Recent Release"<<endl;
cout<<"(3)Katalog"<<endl;
cout<<"Pilih Jenis Film =";cin>>film.jns_flm;
cout<<"Lama Sewa =";cin>>film.lma_sew;
if(strcmp(film.gnr,"1")==0)
{film.jns_flm="New Release";film.hrg=5000;}
else if(strcmp(film.gnr,"2")==0)
{film.jns_flm="Recent Release";film.hrg=3000;}
else if(strcmp(film.gnr,"3")==0)
{film.jns_flm="Katalog";film.hrg=2000;}
film.sub_ttl=film.hrg*film.lma_sew;
film.ttl_byr=film.sub_ttl;
if(film.jml_sew>5)
film.pot=0,1*film.ttl_byr;
else film.pot=0;
film.jum_bar=film.ttl_byr-film.pot;
cout<<"t SE7EN SEASON DVD RENTAL "<<endl;
cout<<"------------------------------------------"<<endl;
cout<<"tanggal sewa = "<<penyewa.tgl_sewa<<endl;
cout<<"nama Penyewa = "<<penyewa.napem<<endl;
cout<<"judul film = "<<film.jdl<<endl;
cout<<"genre = "<<film.gnr<<endl;
cout<<"jenis = "<<film.jns_flm<<endl;
cout<<"harga = "<<film.hrg<<endl;
cout<<"lama = "<<film.lma_sew<<endl;
cout<<"sub total = "<<film.sub_ttl<<endl;
cout<<"--------------------------------------------"<<endl;
film.ttl_byr=film.hrg*film.lma_sew;
cout<<"total bayar = "<<film.ttl_byr<<endl;
film.pot=film.jml_sew;
cout<<"potongan = "<<film.pot<<endl;
film.jum_bar=film.ttl_byr-film.pot;
cout<<"jumlah bayar = "<<film.jum_bar<<endl;
getch();
}




1 komentar: