#include <iostream>
#include <string.h>
using namespace std;
//Nama : Junita Laras Wati
//NIM : 3420230028
// 1. Function Garis()
void garis(int a) {
int i;
for (i=1; i<=a; i++) {printf("-");}
printf("\n");
}
// 2. Function Judul()
void judul() {
garis(38);
puts("Penginapan Pasti Betah");
garis(38);
}
// 3. Function Ketentuan()
void ketentuan() {
puts("List Function");
garis(38);
puts("1. Function Garis()");
puts("2. Function Judul()");
puts("3. Function Ketentuan()");
puts("4. Function TTD()");
puts("5. Function infotarif()");
puts("6. Function Cek_Tipe()");
puts("7. Function Cek_Harga()");
puts("8. Function Cek_Souvenir()");
garis(38);
cout<<"Harus bisa handle huruf besar dan kecil"<<endl;
cout<<"Harus mengunakan Struct"<<endl;
garis(38);
cout<<"Jika lama menginap lebih dari 6 hari maka mendapatkan souvenir Payung Cantik"<<endl;
cout<<"Biaya admin 200.000"<<endl;
cout<<"Total Bayar adalah (Harga dikali Lama Menginap) + Biaya Admin"<<endl;
garis(38);
}
// 4. Function TTD()
void ttd() {
garis(38);
puts("Nama : Junita Laras Wati");
puts("Email : junitalaras18@gmail.com");
garis(38);
}
// 5. Function infotarif()
void infotarif() {
garis(38);
puts("| Kode | Tipe | Harga |");
garis(38);
puts("| A | Anggrek | 800.000 |");
puts("| B | Bougenville | 700.000 |");
puts("| C | Mawar | 600.000 |");
garis(38);
}
// 6. Function Cek_Tipe()
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 "Tipe tidak ditemukkan.";
}
// 7. Function Cek_Harga()
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;
}
// 8. Function Cek_Souvenir()
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;
}