/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, OCaml, VB, Perl, Swift, Prolog, Javascript, Pascal, COBOL, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <stdio.h>
int main(void)
{
int room_type, num_days;
char accomodation_type, card_type;
float price_per_day, discount, amount, net_amount;
do
{
printf("Enter type of room : ");
scanf("%d", &room_type);
if (room_type == -1)
break;
printf("Enter Accomodation Basis(F/H) : ");
scanf(" %c", &accomodation_type);
printf("Enter No of days : ");
scanf("%d", &num_days);
printf("Enter Reward Card Type (G,S,B) : ");
scanf(" %c", &card_type);
if (room_type == 1)
{
switch (accomodation_type)
{
case 'F':
price_per_day = 25555.00;
break;
case 'H':
price_per_day = 17250.00;
break;
default:
printf("Invalid Input\n");
}
}
else if (room_type == 2)
{
switch (accomodation_type)
{
case 'F':
price_per_day = 17500.00;
break;
case 'H':
price_per_day = 12250.00;
break;
default:
printf("Invalid Input\n");
}
}
else if (room_type == 3)
{
switch (accomodation_type)
{
case 'F':
price_per_day = 17500.00;
break;
case 'H':
price_per_day = 12250.00;
break;
default:
printf("Invalid Input\n");
}
}
else
{
printf("Invalid Type of room\n");
}
if (card_type == 'G')
{
discount = 12.5 / 100;
}
else if (card_type == 'S')
{
discount = 11.5 / 100;
}
else if (card_type == 'B')
{
discount = 9.5 / 100;
}
amount = price_per_day * num_days;
net_amount = amount - amount * discount;
printf("Amount(Rs.): %.2f\n\n", net_amount);
}while (1<3);
return 0;
}