PROGRAM "RENTAL GAME"
Assalamualaikum Wr. Wb.
Pada kesempatan kali ini, saya akan membagikan contoh program "RENTAL GAME" berbasis C++
I.Source Code :
#include <iostream>
#include <conio.h>
#include <stdlib.h>
using namespace std;
int pilihan,a[1],hasil,total,subtotal;
char b='Y';
int diskon1()
{
hasil=a[1]*4000;
total=hasil*10/100;
subtotal=hasil-total;
return subtotal;
}
int diskon2()
{
hasil=a[1]*5000;
total=hasil*10/100;
subtotal=hasil-total;
return subtotal;
}
int no_diskon1()
{
subtotal=a[1]*4000;
return subtotal;
}
int no_diskon2()
{
subtotal=a[1]*5000;
return subtotal;
}
void header()
{
cout<<"\t\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"<<endl;
cout<<"\t\t||===============================||"<<endl;
cout<<"\t\t||********** Welcome To *********||"<<endl;
cout<<"\t\t||********** GAME ZONE **********||"<<endl;
cout<<"\t\t||===============================||"<<endl;
cout<<"\t\t|| 1. Paket Game Online ||"<<endl;
cout<<"\t\t||===============================||"<<endl;
cout<<"\t\t|| 2. Paket Game PS 3 ||"<<endl;
cout<<"\t\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"<<endl;
cout<<"\n\n";
}
void header2()
{
cout<<"\t\t||===============================||"<<endl;
cout<<"\t\t||********* Welcome To **********||"<<endl;
cout<<"\t\t||********** GAME ZONE **********||"<<endl;
cout<<"\t\t||===============================||"<<endl;
cout<<"\n\n";
}
void footer()
{
cout<<"\n\n\n";
cout<<"\t +++++++++++++++++++++++++++++++++++++++++++++"<<endl;
cout<<"\t || Terima Kasih Telah Menggunakan Jasa kami||"<<endl;
cout<<"\t || Silahkan datang kembali Di ZONA GAME ||"<<endl;
cout<<"\t +++++++++++++++++++++++++++++++++++++++++++++"<<endl;
}
main()
{
do
{
system("cls");
header();
cout<<"Masukkan Pilihan Anda : ";
cin>>pilihan;
switch (pilihan)
{
case 1:
system("cls");
header2();
cout<<"\t\t******** Paket Game Online ********"<<endl;
cout<<"\t\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"\n\n";
cout<<"Masukkan Lama Penyewaan (Rp 4.000,-/ 1 Jam) = ";
cin>>a[1];
if (a[1]>=3)
{
cout<<"Selamat anda mendapat diskon 10% ";
cout<<"\nTotal yang harus anda bayarkan sebesar Rp ";
cout<<diskon1();
}
else
{
cout<<"Total yang harus anda bayarkan sebesar Rp ";
cout<<no_diskon1();
}
break;
case 2:
system("cls");
header2();
cout<<"\t\t***** Paket Game Playstation 3 *****"<<endl;
cout<<"\t\tzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"<<endl;
cout<<"\n\n";
cout<<"Masukkan Lama Penyewaan (Rp 5000,-/ 1 Jam)= ";
cin>>a[1];
if (a[1]>=3)
{
cout<<"Selamat anda mendapat diskon 10% ";
cout<<"\nTotal yang harus anda bayarkan sebesar Rp ";
cout<<diskon2();
}
else
{
if (a[1]<=3)
{
cout<<"Total yang harus anda bayarkan sebesar Rp ";
cout<<no_diskon2();
}
}
break;
default:
system("cls");
header2();
cout<<"\n\n";
cout<<"\t\t+++++++++++++++++++++++++++++++++++"<<endl;
cout<<"\t\t ERROR!!!, Silahkan Coba Kembali!!"<<endl;
cout<<"\t\t+++++++++++++++++++++++++++++++++++"<<endl;
cout<<"\t\tInputan Tidak Ada Dalam Pilihan "<<endl;
cout<<"\t\tInputan yang bisa di pilih adalah :"<<endl;
cout<<"\t\t||==================================||"<<endl;
cout<<"\t\t|| 1. Paket Game Online ||"<<endl;
cout<<"\t\t||==================================||"<<endl;
cout<<"\t\t|| 2. Paket Game PS 3 ||"<<endl;
cout<<"\t\t||==================================||"<<endl;
cout<<"\n";
break;
}
footer();
cout<<"\n\n";
cout<<"\n\t\t~~~~~~ Ingin Mengulangi Kembali ??~~~~~~";
cout<<"\n\t\t>>> [jika ya tekan Y, tidak tekan T] <<<";
cout<<"\n\t\t Pilihan anda : ";
cin>>b;
}
while (b=='Y'||b=='y');
return 0;
}
#include <conio.h>
#include <stdlib.h>
using namespace std;
int pilihan,a[1],hasil,total,subtotal;
char b='Y';
int diskon1()
{
hasil=a[1]*4000;
total=hasil*10/100;
subtotal=hasil-total;
return subtotal;
}
int diskon2()
{
hasil=a[1]*5000;
total=hasil*10/100;
subtotal=hasil-total;
return subtotal;
}
int no_diskon1()
{
subtotal=a[1]*4000;
return subtotal;
}
int no_diskon2()
{
subtotal=a[1]*5000;
return subtotal;
}
void header()
{
cout<<"\t\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"<<endl;
cout<<"\t\t||===============================||"<<endl;
cout<<"\t\t||********** Welcome To *********||"<<endl;
cout<<"\t\t||********** GAME ZONE **********||"<<endl;
cout<<"\t\t||===============================||"<<endl;
cout<<"\t\t|| 1. Paket Game Online ||"<<endl;
cout<<"\t\t||===============================||"<<endl;
cout<<"\t\t|| 2. Paket Game PS 3 ||"<<endl;
cout<<"\t\txxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"<<endl;
cout<<"\n\n";
}
void header2()
{
cout<<"\t\t||===============================||"<<endl;
cout<<"\t\t||********* Welcome To **********||"<<endl;
cout<<"\t\t||********** GAME ZONE **********||"<<endl;
cout<<"\t\t||===============================||"<<endl;
cout<<"\n\n";
}
void footer()
{
cout<<"\n\n\n";
cout<<"\t +++++++++++++++++++++++++++++++++++++++++++++"<<endl;
cout<<"\t || Terima Kasih Telah Menggunakan Jasa kami||"<<endl;
cout<<"\t || Silahkan datang kembali Di ZONA GAME ||"<<endl;
cout<<"\t +++++++++++++++++++++++++++++++++++++++++++++"<<endl;
}
main()
{
do
{
system("cls");
header();
cout<<"Masukkan Pilihan Anda : ";
cin>>pilihan;
switch (pilihan)
{
case 1:
system("cls");
header2();
cout<<"\t\t******** Paket Game Online ********"<<endl;
cout<<"\t\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"\n\n";
cout<<"Masukkan Lama Penyewaan (Rp 4.000,-/ 1 Jam) = ";
cin>>a[1];
if (a[1]>=3)
{
cout<<"Selamat anda mendapat diskon 10% ";
cout<<"\nTotal yang harus anda bayarkan sebesar Rp ";
cout<<diskon1();
}
else
{
cout<<"Total yang harus anda bayarkan sebesar Rp ";
cout<<no_diskon1();
}
break;
case 2:
system("cls");
header2();
cout<<"\t\t***** Paket Game Playstation 3 *****"<<endl;
cout<<"\t\tzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"<<endl;
cout<<"\n\n";
cout<<"Masukkan Lama Penyewaan (Rp 5000,-/ 1 Jam)= ";
cin>>a[1];
if (a[1]>=3)
{
cout<<"Selamat anda mendapat diskon 10% ";
cout<<"\nTotal yang harus anda bayarkan sebesar Rp ";
cout<<diskon2();
}
else
{
if (a[1]<=3)
{
cout<<"Total yang harus anda bayarkan sebesar Rp ";
cout<<no_diskon2();
}
}
break;
default:
system("cls");
header2();
cout<<"\n\n";
cout<<"\t\t+++++++++++++++++++++++++++++++++++"<<endl;
cout<<"\t\t ERROR!!!, Silahkan Coba Kembali!!"<<endl;
cout<<"\t\t+++++++++++++++++++++++++++++++++++"<<endl;
cout<<"\t\tInputan Tidak Ada Dalam Pilihan "<<endl;
cout<<"\t\tInputan yang bisa di pilih adalah :"<<endl;
cout<<"\t\t||==================================||"<<endl;
cout<<"\t\t|| 1. Paket Game Online ||"<<endl;
cout<<"\t\t||==================================||"<<endl;
cout<<"\t\t|| 2. Paket Game PS 3 ||"<<endl;
cout<<"\t\t||==================================||"<<endl;
cout<<"\n";
break;
}
footer();
cout<<"\n\n";
cout<<"\n\t\t~~~~~~ Ingin Mengulangi Kembali ??~~~~~~";
cout<<"\n\t\t>>> [jika ya tekan Y, tidak tekan T] <<<";
cout<<"\n\t\t Pilihan anda : ";
cin>>b;
}
while (b=='Y'||b=='y');
return 0;
}
II. Flowchart Program
III. Uji Program
Sekian & Terimakasih, Wassalamualaikum Wr.Wb.
Kalau ada yang kurang jelas bisa ditanyakan di komentar...!!

Komentar
Posting Komentar