Prinsip Pemrograman "Program Penggajian ,Booking Hotel dan Karaoke" pada C++

6:16 AM Unknown 0 Comments



Program Penggajian ,Booking Hotel dan Karaoke



#include <iostream.h>
#include <conio.h>
#include <ctype.h>
#include <string>
#include <stdio.h>

void penggajian ()
{
char pilihan;
do{
char nama[50];
int tunjangan;
string anak;
string status,golongan;
int gaji_pokok;
int tunjangan_keluarga=0;
float tunjangan_anak=0;
int total_gaji=0;

cout<<"============================================="<<endl<<endl;
cout<<"        PROGRAM PEANGGAJIAN PEGAWAI          "<<endl<<endl;
cout<<"============================================="<<endl<<endl;
cout<<"Masukkan Nama : ";gets(nama);
cout<<"Masukkan Golongan [1] [2] [3]: "; cin>>golongan;
if (golongan=="1")
{
gaji_pokok=2000000;
cout<<"Gaji Pokok Anda= Rp."<<gaji_pokok<<endl;
}
else if (golongan=="2")
{
gaji_pokok=3000000;
cout<<"Gaji Pokok Anda= Rp."<<gaji_pokok<<endl;
}
else if (golongan=="3")
{
gaji_pokok=4000000;
cout<<"Gaji Pokok Anda= Rp."<<gaji_pokok<<endl;
}

status:
cout<<"Masukkan Status [1]Menikah [2]Duda/Janda [3]Lajang : ";
cin>>status;
if (status=="1")
{
tunjangan_keluarga=(gaji_pokok*50)/100;
cout<<"Tunjangan Keluarga= Rp."<<tunjangan_keluarga<<endl;
}
else if (status=="2")
{
tunjangan_keluarga=(gaji_pokok*50)/100;
cout<<"Tunjangan Keluarga= Rp."<<tunjangan_keluarga<<endl;
}
else if (status=="3")
{
tunjangan_keluarga=0;
cout<<"Tunjangan Keluarga= Rp."<<tunjangan_keluarga<<endl;
}
else
{
cout<<"Salah Input Data"<<endl;
goto status;
}
anak:
cout<<"Masukkan Jumlah Anak :";
cin>>anak;
if (anak>="3")
{
tunjangan_anak=(gaji_pokok*25)/100;
cout<<"Tunjangan Anak= Rp."<<tunjangan_anak<<endl;
}
else if (anak=="2")
{
tunjangan_anak=(gaji_pokok*25)/100;
cout<<"Tunjangan Anak= Rp."<<tunjangan_anak<<endl;
}
else if (anak=="1")
{
tunjangan_anak=(gaji_pokok*25)/100;
cout<<"Tunjangan Anak= Rp."<<tunjangan_anak<<endl;
}
else if (anak=="0")
{
tunjangan_anak=0;
cout<<"Tunjangan Anak= Rp."<<tunjangan_anak<<endl;
}
else
{
cout<<"Salah Input Data"<<endl;
goto anak;
}
tunjangan=tunjangan_keluarga=tunjangan_anak;
total_gaji=gaji_pokok+tunjangan_keluarga+tunjangan_anak;
cout<<"============================="<<endl;
cout<<"Nama   : "<<nama<<endl;
cout<<"Status : "<<status<<endl;
cout<<"Tunjangan       = Rp."<<tunjangan<<endl;
cout<<"Total Gaji Anda = Rp."<<total_gaji<<endl;
cout<<"============================="<<endl;
cout<<"Kembali ke awal"<<endl;
cout<<"Pilih [y/n] : "; cin>>pilihan;
}while (pilihan=='y');
cout<<"           Trimakasih        "<<endl;
getche ();
}

#include <iostream.h>
#include <conio.h>
#include <ctype.h>
#include <stdio.h>

void booking_room()
{
char nama[50];
int jenis_room,pay,lama_menginap,total_pembayaran;
cout<<"=========================================================================="<<endl;
cout<<"                    Selamat Datang Di Hotel Danan Paradise                "<<endl;
cout<<"=========================================================================="<<endl;
cout<<"Masukkan Nama : "; gets(nama);
here:
cout<<"Pilih Jenis Room [1]SingleRoom [2]DoubleRoom [3]DeluxeRoom [4]SuiteRoom : "; cin>>jenis_room;
if(jenis_room==1)
     {
   pay=650000;
   cout<<"Harga Room = Rp."<<pay<<"/Malam"<<endl;
   }
else if(jenis_room==2)
     {
   pay=900000;
   cout<<"Harga Room = Rp."<<pay<<"/Malam"<<endl;
   }
else if(jenis_room==3)
     {
   pay=1200000;
   cout<<"Harga Room = Rp."<<pay<<"/Malam"<<endl;
   }
else if(jenis_room==4)
     {
   pay=1500000;
   cout<<"Harga Room = Rp."<<pay<<"/Malam"<<endl;
   }
   else
     {
   cout<<"Salah Input Data"<<endl;
   goto here;
   }
cout<<"Masukkan Jumlah Hari Menginap : "; cin>>lama_menginap;
total_pembayaran=pay*lama_menginap;
clrscr;
cout<<"====================================================="<<endl;
cout<<"Nama            : "<<nama<<endl;
cout<<"Jenis Room    :   "<<jenis_room<<endl;
cout<<"Lama Menginap : "<<lama_menginap<<" Hari"<<endl;
cout<<"====================================================="<<endl;
cout<<"Total Pembayaran    : "<<total_pembayaran<<endl;
getch ();
}

#include <iostream.h>
#include <conio.h>
#include <ctype.h>
#include <stdio.h>

void karaoke()
{
char nama[10];
int jenis_paket,pay,lama_karaoke,total_pembayaran;
cout<<"=========================================================================="<<endl;
cout<<"                    Wellcome to Danan Karaoke                             "<<endl;
cout<<"=========================================================================="<<endl;
cout<<"Masukkan Nama : "; gets(nama);
here:
cout<<"Pilih Jenis Paket Karaoke [1]StandarKaraoke [2]SpecialKaraoke "; cin>>jenis_paket;
if(jenis_paket==1)
     {
   pay=25000;
   cout<<"Harga Paket = Rp."<<pay<<"/Jam"<<endl;
   }
else if(jenis_paket==2)
     {
   pay=50000;
   cout<<"Harga Paket = Rp."<<pay<<"/MJam"<<endl;
   }
   else
     {
   cout<<"Salah Inpun Data"<<endl;
   goto here;
   }
cout<<"Masukkan Berapa Jam Karaoke : "; cin>>lama_karaoke;
total_pembayaran=pay*lama_karaoke;
cout<<"====================================================="<<endl;
cout<<"Nama            : "<<nama<<endl;
cout<<"Jenis Paket   :   "<<jenis_paket<<endl;
cout<<"Lama Karaoke  : "<<lama_karaoke<<" Jam"<<endl;
cout<<"====================================================="<<endl;
cout<<"Total Pembayaran    : Rp."<<total_pembayaran<<endl;
getch ();
}

void main()
{
int pil;
cout<<"=========MENU==========\n";
cout<<" [1]Penggajian Pegawai       \n";
cout<<" [2]Booking Hotel            \n";
cout<<" [3]Karaoke                  \n";
cout<<" [4]Exit                     \n";
cout<<"=======================\n";
cin>>pil;
clrscr();

switch(pil)
{
     case 1 :
   {
   penggajian(); break;
   }
   case 2 :
   {
   booking_room(); break;
   }
   case 3 :
   {
   karaoke(); break;
   }
   default :
   {

   }
}

}

0 comments: