Ini adalah soal UTS Algoritma & Pemrograman semester 1 pada bulan November 2014 dan Kode Programnya.
KETENTUAN SOAL
LOSMEN RAINBOW INN
a. input nama petugas,nama customer,kode kamar,lama inap.
b. kode kamar jenis kamar biaya inap
S STANDARD ROOM-SINGLE BED 125000
D DELUXE ROOM-DOUBLE BED,INCLUDE BREAKFAST 225000
F FAMILY ROOM-DOUBLE BED,EXTRA BED,INCLUDE BREAKFAST 270000
C. TOTAL BAYAR=HARGA SEWA*LAMA SEWA
D. DISKON: JIKA LAMA INAP>3HARI DISKON 5% SELAIN ITU 0%
E. UANG KEMBALI=UANG BAYAR-UANG GRAND.
KETENTUAN SOAL
LOSMEN RAINBOW INN
a. input nama petugas,nama customer,kode kamar,lama inap.
b. kode kamar jenis kamar biaya inap
S STANDARD ROOM-SINGLE BED 125000
D DELUXE ROOM-DOUBLE BED,INCLUDE BREAKFAST 225000
F FAMILY ROOM-DOUBLE BED,EXTRA BED,INCLUDE BREAKFAST 270000
C. TOTAL BAYAR=HARGA SEWA*LAMA SEWA
D. DISKON: JIKA LAMA INAP>3HARI DISKON 5% SELAIN ITU 0%
E. UANG KEMBALI=UANG BAYAR-UANG GRAND.
Kode Program
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
main()
{
char petugas[20],customer[20],kode,jenis[100];
int lama,biaya,total,bayar,kembali,grand;
float diskon;
clrscr();
cout<<"****************==============******************"<<endl;
cout<<" Losmen RAINBOW Inn "<<endl;
cout<<"================================================"<<endl;
cout<<"Input Nama Petugas :"; cin>>petugas;
cout<<"Input Nama Customer :"; cin>>customer;
cout<<endl;
cout<<"Input Kode Kamar [S/D/F] :"; cin>>kode;
cout<<"Input Lama Inap :"; cin>>lama;
clrscr();
switch(kode)
{
case 'S':
case 's':
strcpy(jenis,"STANDARD ROOM-SINGLE BED");
biaya=125000;
break;
case 'D':
case 'd':
strcpy(jenis,"DELUXE ROOM-DOUBLE BED,INCLUDE BREAKFAST");
biaya=225000;
break;
case 'F':
case 'f':
strcpy(jenis,"FAMILY ROOM-DOUBLE BED,EXTRA BED,INCLUDE BREAKFAST");
biaya=275000;
break;
default:
strcpy(jenis,"JENIS KAMAR TIDAK TERSEDIA");
biaya=0;
}
cout<<"****************==============******************"<<endl;
cout<<" Losmen RAINBOW Inn "<<endl;
cout<<"================================================"<<endl;
cout<<"Nama Petugas :"<<petugas<<endl;
cout<<"Nama Customer :"<<customer<<endl;
cout<<"Jenis Kamar :"<<jenis<<endl;
cout<<"Biaya Inap/hari :"<<biaya<<endl;
cout<<"Lama :"<<lama<<endl;
cout<<"================================================"<<endl;
total=biaya*lama;
cout<<" Total Bayar :"<<total<<endl;
if(lama>3)
{
diskon=total*0.05;
}
else
{
diskon=total*0;
}
cout<<" Diskon :"<<diskon<<endl;
grand=total-diskon;
cout<<" Grand Total :"<<grand<<endl;
cout<<" Uang Bayar :"; cin>>bayar;
kembali=bayar-grand;
cout<<" Uang Kembali :"<<kembali<<endl;
cout<<"________________________________________________"<<endl;
getch();
}
Nah yang ini tampilannya:
Semoga bermanfaat dan bisa digunakan untuk latihan sebelum UTS
Soal UTS Semester 1 Algoritma dan Pemrograman I Tahun 2014
Reviewed by Dwi Yuli Wibowo
on
January 20, 2015
Rating:
No comments:
Pembaca yang baik tinggalkan komentar yang baik