Kamis, 03 November 2022

UAS LOGIKA ALGORITMA C++ SEMESTER I

Hey Maba! UAS nya susah ya? yaudah kalo kebetulan soalnya sama bisa memodifikasi source code punya ku, inipun sebenarnya terinspirasi dari punya orang juga, tapi dimodif lagi sih biar pas dibuka dosen jadi terlihat keren kayagini :


#include <iostream>

#include <windows.h>
using namespace std;

int main(){
    system("Color 0A");
    char nama[50], ktp[20],alamat[20], kota[20],tlp[20],pekerjaan[20], pilih, i;
    string nopol[]={"KH 2112 AF","KH 2859 AF","KH 2547 AF","KH 2965 AF"};
    string mobil[]={"ZENIA ","AVANSA ","ERTIGA ","AVANSA VELOS "};
    int hargasewa[]={500000, 500000,525000,600000};
    int jumlah, harga, menu, total, biayatambah, lama,kode;
cout << R"(
PROGRAM SEWA MOBIL UAS LOGIKA DAN ALGORITMA
  ___                         _  ______           _        _
 / _ \                       (_) | ___ \         | |      | |
/ /_\ \_ __   __ _  __ _ _ __ _  | |_/ /___ _ __ | |_ __ _| |
|  _  | '_ \ / _` |/ _` | '__| | |    // _ \ '_ \| __/ _` | |
| | | | | | | (_| | (_| | |  | | | |\ \  __/ | | | || (_| | |
\_| |_/_| |_|\__, |\__, |_|  |_| \_| \_\___|_| |_|\__\__,_|_|
              __/ | __/ |                                    
             |___/ |___/                                    
 
)" << '\n';
        cout<<"===============RENTAL NO. 1 DI PALANGKA RAYA==================="<<endl;
        cout<<endl;
        cout <<"-------------------------------------------------------------"<<endl;
        cout <<"\t\tMASUKAN DATA PENYEWA (TANPA SPASI)"<<endl;
        cout <<"-------------------------------------------------------------"<<endl;
        cout<<endl;
        cout<<"Nama : " ; cin>>nama;
        cout<<"No.KTP : " ; cin>>ktp;
        cout<<"Alamat : " ; cin>>alamat;
        cout<<"Kota : " ; cin>>kota;
        cout<<"telepon : " ; cin>>tlp;
        cout<<endl;
pilih :
    system("cls");
        cout<<"-------------------------------------------------------------------------"<<endl;
        cout<<"\t\t\tMOBIL YANG TERSEDIA"<<endl;
        cout<<"-------------------------------------------------------------------------"<<endl;
        cout<<"|    [1] ZENIA       = Rp 500.000                |"<<endl;
        cout<<"|    [2] AVANSA      = RP 500.000                |"<<endl;
        cout<<"|    [3] ERTIGA      = RP 525.000                |"<<endl;
        cout<<"|    [4] AVANSA VELOS    = Rp 600.000                |"<<endl;
        cout<<"-------------------------------------------------------------------------"<<endl;
       
        cout<<"Silahkan Pilih mobil anda (1-4): "; cin >> menu;
//SWITCH            
        switch (menu){
            case 1:
                i=0;
                break;
            case 2:
                i=1;
                break;
            case 3:
                i=2;
                break;
            case 4:
                i=3;
                break;
            default:
                cout << "pilihan anda salah, coba lagi..." << endl;
                goto pilih;
        }
cout<<"lama sewa (hari) : ";cin>> lama ;
supir :
//SELEKSI KONDISI
cout<<"apakah anda ingin menggunakan Jasa Supir? (y/n)";cin>>pilih;
if(pilih == 'Y' || pilih == 'y' )
{
    biayatambah=250000;
    cout <<"biaya tambahan/hari :     "<<biayatambah;
}
    else if (pilih == 'N' ||pilih == 'n')
{
    biayatambah=0;
    cout <<"biaya tambahan/hari :     "<<biayatambah;
}
else
{
cout <<"-------------------------------------------------------------"<<endl;
cout <<"\tpilihan anda salah!!!"<<endl;
cout <<"-------------------------------------------------------------"<<endl;
goto supir;
}
cetak :
cout <<endl;
cout <<"-------------------------------------------------------------"<<endl;  
cout<<"cetak struk? (y/n)";cin>>pilih;
if(pilih == 'Y' || pilih == 'y' )
{
    goto struk;
}
    else if (pilih == 'N' ||pilih == 'n')
{
    goto pilih;
}
else
{
cout <<"-------------------------------------------------------------"<<endl;
cout <<"\tpilihan anda salah!!!"<<endl;
cout <<"-------------------------------------------------------------"<<endl;

struk :
        system("cls");
        cout << "-------------------------------------------------------" << endl;
        cout << "|                RENTAL MOBIL ANGGRI                   |" << endl;
        cout << "-------------------------------------------------------" << endl;
        cout << "\tNama Pemesan         : " << nama     <<endl;
        cout << "\tNo. KTP              : " << ktp     <<endl;
        cout << "\talamat               : " << alamat     <<endl;
        cout << "\tkota             : " << kota     <<endl;
        cout << "\ttelepon              : " << tlp     <<endl;
        cout << "\tMerk Mobil           : " << mobil[i]     <<endl;
        cout << "\tNomor Polisi         : " << nopol [i]  <<endl;
        cout << "\tHarga sewa/hari          : Rp "  << hargasewa[i] << endl;
        cout << "\tlama sewa/hari           :  " << lama    <<endl;
        cout << "\tbiaya tambahan           : Rp " << biayatambah    <<endl;
        cout << "\tTotal Pembayaran     : Rp " << hargasewa[i]*lama+(biayatambah*lama)<<endl;
        cout << endl;
                       
cout <<"-------------------------------------------------------------"<<endl;
cout <<"\tTERIMA KASIH TELAH MENGGUNAKAN PROGRAM INI"<<endl;
cout <<"-------------------------------------------------------------"<<endl;      
        return 0;
    }
}

 

Tidak ada komentar:

Posting Komentar