Tugas12.1

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <string.h> using namespace std; //Nadzia Dibda //3420230011 void Garis() { puts("-------------------------------------------------"); } void judul () { Garis(); cout << "PENGINAPAN PASTI BETAH" << endl; Garis(); cout << "List Function" << endl; Garis(); cout << "1. Function Garis()" << endl; cout << "2. Function Judul()" << endl; cout << "3. Function Ketentuan()" << endl; cout << "4. Function TTB()" << endl; cout << "5. Function Tarif()" << endl; cout << "6. Function Cek_Tipe()" << endl; cout << "7. Function Cek_Harga()" << endl; cout << "8. Function Cek_Souvenir()" << endl; Garis(); } void ketentuan () { cout<<"Harus bisa handle hiruf besar dan kecil." << endl; cout<<"Harus menggunakan Struct." << endl; Garis(); cout<<"Jika lama menginap lebih dari 6 hari maka mendaptkan souvenir Payung Cantik" << endl; cout<<"Biaya admin 200.000" << endl; cout<<"Total Bayar Adalah (Harg Dikali Lama Menginap) + Biaya Admin" << endl; Garis(); } void ttd () { Garis(); puts("Nama : Nadzia Dibda"); puts("Email : dibdaaulina@gmail.com");; Garis(); } void infotarif () { Garis(); puts(" | Kode | Tipe | Harga |"); Garis(); puts(" | A | Anggrek | 800.000 |"); puts(" | B | Bougenvile | 700.000 |"); puts(" | c | Mawar | 600.000 |"); Garis(); } string Cek_Tipe(char kodetipe) { if (kodetipe == 'A' || kodetipe == 'a') return "Anggrek"; else if (kodetipe == 'B' || kodetipe == 'b') return "Bougenville"; else if (kodetipe == 'C' || kodetipe == 'c') return "Mawar"; else return "Tidak Diketahui."; } float Cek_Harga (int kodetipe) { int harga; if (kodetipe == 'A' || kodetipe == 'a') { harga = 800000; } else if (kodetipe == 'B' || kodetipe == 'b') { harga = 700000; } else if (kodetipe =='C' || kodetipe == 'c') { harga = 600000; } else { harga = 0; } return harga; } string Cek_Souvenir (int lamasewa) { if (lamasewa > 6) return "Payung Cantik"; else return "-"; } int main() { judul(); ketentuan(); struct data { char nama[10]; char kode; int lama; }; data penyewa; cout<<"Nama Penyewa : <input>"; cin>>penyewa.nama; cout<<endl; cout<<"Kode Kamar [A/B/C} : <input>"; cin>>penyewa.kode; cout<<endl; cout<<"Lama Penginap : <input>"; cin>>penyewa.lama; cout<<endl; infotarif(); float harga = Cek_Harga(penyewa.kode); float admin = 200000; float total = (harga * penyewa.lama) + admin; printf("Nama Penyewa : %s \n", penyewa.nama); printf("Kode Kamar [A/B/C] : %c \n", penyewa.kode); printf("Lama Menginap : %d hari \n", penyewa.lama); printf("Harga Sewa : Rp. %.2f \n", harga); cout<<"Tipe Kamar : " <<Cek_Tipe(penyewa.kode)<<endl; cout<<"Souvenir : " <<Cek_Souvenir(penyewa.lama)<<endl; printf("Administrasi : Rp. %.2f \n", admin); printf("Total : Rp. %.2f \n", total); ttd(); return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines