Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Soal No.

1
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <string.h>
void main()
{
clrscr();
char mrn[15], np[20], kr[10], sp[10], nr[10];
int li;
long tarif, br,pajak,jp;
cout<<"Medical Record number :";cin>>mrn;
cout<<"Nama pasien : ";gets(np);
cout<<"Kode Ruang : ";cin>>kr;
cout<<"Lama Inap : ";cin>>li;
cout<<"Status Pasien : ";cin>>sp;cout<<endl<<endl;
if (strcmp(kr,"A")==0 || strcmp(kr,"a")==0) {
strcpy(nr,"Melati");
tarif=100000;
if(strcmp(sp,"umum")==0){
br=li*tarif;
}
else if(strcmp(sp,"askes")==0){
br=li*tarif*0.4;
}
}
else if (strcmp(kr,"B")==0 || strcmp(kr,"b")==0) {
strcpy(nr,"Mawar");
tarif=150000;
if(strcmp(sp,"umum")==0){

br=li*tarif;
}
else if(strcmp(sp,"askes")==0){
br=li*tarif*0.4;
}
}
else if (strcmp(kr,"C")==0 || strcmp(kr,"c")==0) {
strcpy(nr,"anggrek");
tarif=200000;
if(strcmp(sp,"umum")==0){
br=li*tarif;
}
else if(strcmp(sp,"askes")==0){
br=li*tarif*0.4;
}
}
pajak=br*10/100;
jp=br+pajak;
cout<<"Nama Ruangan : "<<nr<<endl;
cout<<"Tarif / Hari : "<<tarif<<endl;
cout<<"Biaya Rawat : "<<br<<endl;
cout<<"pajak : "<<pajak<<endl;
cout<<"Jumlah Pembayar : "<<jp<<endl;
}

Soal No.2
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <string.h>
void main()
{
clrscr();
char gb[15], nt[20], tk[10];
int lama,lebih;

long hp, dis, jt;


cout<<"Gest Number :";cin>>gb;
cout<<"Nama Tamu : ";gets(nt);
cout<<"Type Kamar : ";cin>>tk;
cout<<"Lama : ";cin>>lama;
cout<<endl<<endl;
if (strcmp(tk,"Single")==0 || strcmp(tk,"single")==0) {
hp=50000;
if(lama>10){
lebih=lama%10;
dis=hp*0.1*lebih; }
else

dis=0;

}
else if (strcmp(tk,"Double")==0 || strcmp(tk,"double")==0) {
hp=60000;
if(lama>5){
lebih=lama%5;
dis=hp*10/100; }
else

dis=0;

}
else if (strcmp(tk,"Family")==0 || strcmp(tk,"family")==0) {
hp=70000;
if(lama>7){
lebih=lama%10;
dis=hp*10/100; }
else

dis=0;

}
jt=hp*lama-dis;
cout<<"Harga / Hari : "<<hp<<endl;
cout<<"Lama : "<<lama<<endl;

cout<<"Discount : "<<dis<<endl;
cout<<"Jumlah Tagihan : "<<jt<<endl;
}

You might also like