#include <iostream.h>

#include <conio.h>

//#include <fstream.h>

#include <stdio.h>

//#include <iomanip.h>

//#include <string.h>

//#include <stdlib.h>

//#include <ctype.h>

//#include <process.h>

//#include <math.h>

#include <windows.h>

#include <dos.h>

//------------------------------------------------------------------------------

void menu(); void garis(); void setcolor();

void box();void design(); int tim();

void info(); void rental(); void kembali();

//------------------------------------------------------------------------------

main()

{

         clrscr();

   menu();

getch();

}

//------------------------------------------------------------------------------

void garis()

{cout<<"\n----------------------------------------------------------\n";}

//------------------------------------------------------------------------------

void setcolor(unsigned short color)         //begining of set color funtion

{

     HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);          //gets std handle

     SetConsoleTextAttribute(hCon,color);         //Sets Console Text Attribute HCon color.

}

//------------------------------------------------------------------------------

void menu()

{

        textbackground(BLUE);

        setcolor(7);

        box();

        textbackground(BLACK);

        int op;

        do

        {

                clrscr();

      design();

                setcolor(7);

                gotoxy(32,8);

                setcolor(7);

                textcolor(WHITE);

                cprintf("SELAMAT DATANG DI RENTAL INFORMATION CENTRE:");

                gotoxy(32,10);

                setcolor(7);

                cprintf("     1.RENTAL KENDARAAN     ");

                gotoxy(32,12);

                setcolor(7);

                cprintf("     2.PENGEMBALIAN KENDARAAN     ");

                gotoxy(32,14);

                setcolor(7);

                cprintf("     3.INFO RENTAL           ");

                gotoxy(33,16);

                cprintf("    4.EXIT     ");

                gotoxy(33,18);

                setcolor(7);

                cprintf("    MASUKKAN PILIHAN ANDA:     ");

                cin>>op;

                switch(op)

                {

                        case 1:

                        rental();

         getch();

         break;

                        case 2:

                        kembali();

         getch();

                        break;

                        case 3:

                        info();

         getch();

         case 4:

         exit(0);

         break;

         default:

         cout<<"\n\tKode Tidak Dikenal";

                        break;

       }

     }while(op<=3);

}

//------------------------------------------------------------------------------

void info()

{

clrscr();

        cout<<"                             \tDAFTAR KENDARAAN";

        gotoxy (2,5);

        cout<<"------------------------------------------------------------------------------\n";

        gotoxy (1,6); cout<<"| No.  ";

        gotoxy (6,6); cout<<"| TIPE ";

        gotoxy (14,6); cout<<"|  KODE";

        gotoxy (23,6); cout<<"|      JENIS";

        gotoxy (40,6); cout<<"|   KAPASITAS";

        gotoxy (55,6); cout<<"|    HARGA";

        gotoxy (69,6); cout<<"|    KET";

        gotoxy (80,6);  cout<<"|\n";

        gotoxy (1,7);

        cout<<"|------------------------------------------------------------------------------|\n";

        gotoxy (1,8); cout<<"| 1.";

        gotoxy (6,8); cout<<"|Angktn";

        gotoxy (14,8); cout<<"|   001";

        gotoxy (23,8); cout<<"| BAK";

        gotoxy (40,8); cout<<"|1500 kg";

        gotoxy (55,8); cout<<"| Rp.200.000";

        gotoxy (69,8); cout<<"|    ";

        gotoxy (80,8);  cout<<"|\n";

        gotoxy (1,9); cout<<"|  ";

        gotoxy (6,9); cout<<"|Barang";

        gotoxy (14,9); cout<<"|   002";

        gotoxy (23,9); cout<<"| BOX";

        gotoxy (40,9); cout<<"|2500 kg";

        gotoxy (55,9); cout<<"| Rp.250.000";

        gotoxy (69,9); cout<<"|";

        gotoxy (80,9);  cout<<"|\n";

        gotoxy (1,10); cout<<"| ";

        gotoxy (6,10); cout<<"| ";

        gotoxy (14,10); cout<<"|   003";

        gotoxy (23,10); cout<<"| TRUCK";

        gotoxy (40,10); cout<<"|5000 kg";

        gotoxy (55,10); cout<<"| Rp.300.000";

        gotoxy (69,10); cout<<"|";

        gotoxy (80,10);  cout<<"|\n";

        gotoxy (1,11);

        cout<<"|------------------------------------------------------------------------------|\n";

        gotoxy (1,12); cout<<"| 2.";

        gotoxy (6,12); cout<<"|Travel";

        gotoxy (14,12); cout<<"|   004";

        gotoxy (23,12); cout<<"| Pribadi";

        gotoxy (40,12); cout<<"|8  orang";

        gotoxy (55,12); cout<<"| Rp.350.000";

        gotoxy (69,12); cout<<"|    ";

        gotoxy (80,12);  cout<<"|\n";

        //gotoxy (1,13); cout<<"| ";                              

        gotoxy (6,13); cout<<"| ";

        gotoxy (14,13); cout<<"|   005";

        gotoxy (23,13); cout<<"| Mini Bus";

        gotoxy (40,13); cout<<"|20 orang";

        gotoxy (55,13); cout<<"| Rp.400.000";

        gotoxy (69,13); cout<<"|";

        gotoxy (80,13);  cout<<"|\n";

        gotoxy (1,14); cout<<"| ";

        gotoxy (6,14); cout<<"| ";

        gotoxy (14,14); cout<<"|   006";

        gotoxy (23,14); cout<<"| BUS";

        gotoxy (40,14); cout<<"|50 orang";

        gotoxy (55,14); cout<<"| Rp.450.000";

        gotoxy (69,14); cout<<"|";

        gotoxy (80,14);  cout<<"|\n";

        gotoxy (1,15);

        cout<<"|------------------------------------------------------------------------------|\n";

        gotoxy (1,16); cout<<"| 3.";

        gotoxy (6,16); cout<<"|Bisnis";

        gotoxy (14,16); cout<<"|   007";

        gotoxy (23,16); cout<<"| AC";

        gotoxy (40,16); cout<<"|40 orang";

        gotoxy (55,16); cout<<"| Rp.500.000";

        gotoxy (69,16); cout<<"|    ";

        gotoxy (80,16);  cout<<"|\n";

        gotoxy (1,17); cout<<"|  ";

        gotoxy (6,17); cout<<"| ";

        gotoxy (14,17); cout<<"|   008";

        gotoxy (23,17); cout<<"| Ekonomi";

        gotoxy (40,17); cout<<"|40-60 orang";

        gotoxy (55,17); cout<<"| Rp.550.000";

        gotoxy (69,17); cout<<"|";

        gotoxy (80,17);  cout<<"|\n";

        gotoxy (2,18);

        cout<<"------------------------------------------------------------------------------\n";

   //getch();

   //menu();

}

//------------------------------------------------------------------------------

void rental()

{

   char nama[50],alamat[50],nokontak[13];

   int tarif,total,umur,noseri;

   struct{

           int lama;

      int tgl;

      int sewa;

      int kembali;

      }kend;

   clrscr();

   garis();

   gotoxy(25,3);

   cout<<"DATA PELANGGAN";garis();

        cout<<"\n\n\tInput Nama: ";gets(nama);

   cout<<"\n\tInput Umur: ";cin>>umur;

   if(umur<18)

   {

   cout<<"\n\n\nANDA MASIH DI BAWAH UMUR TIDAK DIPERBOLEHKAN UNTUK MENGEMUDI";

   getch();

   exit(0);

   }

   cout<<"\n\tInput Alamat: ";

   gets(alamat);

   cout<<"\n\tInput No. Kontak: ";

   cin>>nokontak;

   clrscr();

   info();

   cout<<"\n\tKode Kendaraan : 00";cin>>noseri;

    if(noseri<9&&noseri<1)

   {

   cout<<"\n\tMaaf Kode Kendaraan Tidak Terdaftar";

   getch();

   exit(0);

   }

   cout<<"\n\tInput Lama Sewa [Hari]: ";cin>>kend.lama;

   clrscr();

   garis();

   cout<<"\t\tStruk Pembayaran";

   garis();

   cout<<"\tNama : "<<nama<<endl;

   cout<<"\tUmur : "<<umur<<endl;

   cout<<"\tAlamat : "<<umur<<endl;

   cout<<"\tNo. Kontak : "<<nokontak<<endl;

   cout<<"\tKode Kendaraan : 00"<<noseri<<endl;

   cout<<"\tLama Sewa : "<<kend.lama<<" Hari"<<endl;

   if(noseri==1)

   {tarif=200000;

   total=kend.lama*tarif;}

   else if(noseri==2)

   {tarif=250000;

   total=kend.lama*tarif;}

   else if(noseri==3)

   {tarif=300000;

   total=kend.lama*tarif;}

   else if(noseri==4)

   {tarif=350000;

   total=kend.lama*tarif;}

   else if(noseri==5)

   {tarif=400000;

   total=kend.lama*tarif;}

   else if(noseri==6)

   {tarif=450000;

   total=kend.lama*tarif;}

   else if(noseri==7)

   {tarif=500000;

   total=kend.lama*tarif;}

   else if(noseri==8)

   {tarif=550000;

   total=kend.lama*tarif;}

   cout<<"\tTotal Bayar : "<<total<<endl;

   cout<<"\n\n\t\tTERIMA KASIH ATAS KUNJUNGANNYA";

   cout<<"\n\t\tSELAMAT BERAKTIVITAS KEMBALI";

}

//------------------------------------------------------------------------------

void kembali()

{

        int kd,telat,denda;

        char tipe[3][20]={"Angkut","Pariwisata","Bisnis"};

   char noseri[8][20]={"001","002","003","004","005","006","007","008"};

   char jenis [8][20]={"Bak Terbuka","Box","Truk","Minibus","Bus","Pribadi","AC","Ekonomi"};

   clrscr();

   garis();

        cout<<"\n\tKode Kendaraan : ";cin>>kd;

   switch(kd)

   {

   case 1:

           cout<<"\tTipe Mobil : "<<tipe[0]<<endl;

      cout<<"\tNomor Seri : "<<noseri[0]<<endl;

      cout<<"\tJenis Kendaraan:"<<jenis[0]<<endl;

   break;

   case 2:

           cout<<"\tTipe Mobil : "<<tipe[0]<<endl;

      cout<<"\tNomor Seri : "<<noseri[1]<<endl;

      cout<<"\tJenis Kendaraan:"<<jenis[1]<<endl;

   break;

   case 3:

           cout<<"\tTipe Mobil : "<<tipe[0]<<endl;

      cout<<"\tNomor Seri : "<<noseri[2]<<endl;

      cout<<"\tJenis Kendaraan:"<<jenis[2]<<endl;

   break;

   case 4:

           cout<<"\tTipe Mobil : "<<tipe[1]<<endl;

      cout<<"\tNomor Seri : "<<noseri[3]<<endl;

      cout<<"\tJenis Kendaraan:"<<jenis[3]<<endl;

   break;

   case 5:

           cout<<"\tTipe Mobil : "<<tipe[1]<<endl;

      cout<<"\tNomor Seri : "<<noseri[4]<<endl;

      cout<<"\tJenis Kendaraan:"<<jenis[4]<<endl;

   break;

   case 6:

           cout<<"\tTipe Mobil : "<<tipe[1]<<endl;

      cout<<"\tNomor Seri : "<<noseri[5]<<endl;

      cout<<"\tJenis Kendaraan:"<<jenis[5]<<endl;

   break;

   case 7:

           cout<<"\tTipe Mobil : "<<tipe[2]<<endl;

      cout<<"\tNomor Seri : "<<noseri[6]<<endl;

      cout<<"\tJenis Kendaraan:"<<jenis[6]<<endl;

   break;

   case 8:

           cout<<"\tTipe Mobil : "<<tipe[2]<<endl;

      cout<<"\tNomor Seri : "<<noseri[7]<<endl;

      cout<<"\tJenis Kendaraan:"<<jenis[7]<<endl;

   break;

   default:

   cout<<"\t\tKode Tidak Terdaftar "<<endl;

   break;

}

        cout<<"\tJumlah Telat [Hari] : ";cin>>telat;

   if(kd<=8 && kd>0)

   denda=telat*50000;

   else

   denda=0;

   cout<<"\n\tDenda : RP. "<<denda;

   cout<<"\n\n\t\tTERIMA KASIH ATAS KUNJUNGANNYA";

   cout<<"\n\t\tSELAMAT BERAKTIVITAS KEMBALI";

}

//------------------------------------------------------------------------------

void box()

{

          char c1=178, c2=177, c3=176;

     gotoxy(1,2);

          for(int i=1; i<=1840; i++)

          {

        int j=0;

        gotoxy(j,2);

             cout<<c3;

        j++;

        if(j>=79)

        j=0;

     }

}

//------------------------------------------------------------------------------

void design()

  {

    textcolor(WHITE);

    gotoxy(2,2);

    cprintf("\xC9");

    int i;

    for(i=1;i<=74;i++)

      cprintf("\xCD");

    gotoxy(77,2);

    cprintf("\xBB");

     gotoxy(2,3);cprintf("\xBA");gotoxy(2,4);cprintf("\xBA");gotoxy(2,5);cprintf("\xBA");gotoxy(2,6);cprintf("\xBA");

     gotoxy(2,7);cprintf("\xBA");gotoxy(2,8);cprintf("\xBA");gotoxy(2,9);cprintf("\xBA");gotoxy(2,10);cprintf("\xBA");

     gotoxy(2,11);cprintf("\xBA");gotoxy(2,12);cprintf("\xBA");gotoxy(2,13);cprintf("\xBA");gotoxy(2,14);cprintf("\xBA");

     gotoxy(2,15);cprintf("\xBA");gotoxy(2,16);cprintf("\xBA");gotoxy(2,17);cprintf("\xBA");gotoxy(2,18);cprintf("\xBA");

     gotoxy(2,19);cprintf("\xBA");gotoxy(2,20);cprintf("\xBA");gotoxy(2,21);cprintf("\xBA");gotoxy(2,22);cprintf("\xCC");

     gotoxy(2,23);cprintf("\xBA");gotoxy(2,24);cprintf("\xC8");

     gotoxy(3,24);

     for(i=1;i<=74;i++)

       cprintf("\xCD");

     gotoxy(77,18);cprintf("\xBA");gotoxy(77,19);cprintf("\xBA");gotoxy(77,20);cprintf("\xBA");gotoxy(77,21);cprintf("\xBA");

     gotoxy(77,23);cprintf("\xBA");gotoxy(77,24);cprintf("\xBC");

     gotoxy(3,22);

     for(i=1;i<=74;i++)

       cprintf("\xCD");

     gotoxy(77,22);cprintf("\xB9");gotoxy(77,3);cprintf("\xBA");gotoxy(77,4);cprintf("\xBA");gotoxy(77,5);cprintf("\xBA");

     gotoxy(77,6);cprintf("\xBA");gotoxy(77,7);cprintf("\xBA");gotoxy(77,8);cprintf("\xBA");gotoxy(77,9);cprintf("\xBA");

     gotoxy(77,10);cprintf("\xBA");gotoxy(77,11);cprintf("\xBA");gotoxy(77,12);cprintf("\xBA");gotoxy(77,13);cprintf("\xBA");

     gotoxy(77,14);cprintf("\xBA");gotoxy(77,15);cprintf("\xBA");gotoxy(77,16);cprintf("\xBA");gotoxy(77,17);cprintf("\xBA");

     tim();

  }

//===============================DATE AND TIME===============================

int tim()

  {

    struct date d;

    struct time t;

    getdate(&d);

    gettime(&t);

    gotoxy(4,23);

    cprintf("Tanggal : %d/%d/%d ",d.da_day,d.da_mon,d.da_year);

    gotoxy(23,23);

    cprintf(" Waktu: %d:%d:%d",t.ti_hour,t.ti_min,t.ti_sec);

    gotoxy(59,23);

    cprintf("PT. BAROQUE WORKS");

    return 0;

  }