forked from MAYANK25402/Hactober-2023-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hotel Room Rate Calculator.c
100 lines (73 loc) · 1.59 KB
/
Hotel Room Rate Calculator.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*user to enter the type of the room, accommodation type ( F- Full
Board, H- Half Board ), number of days and the Card type ( G, S, B ) and calculate the amount
need to be paid for the given no of days. */
#include <stdio.h>
int main (void){
int typeOfRoom,days;
float amount,discount;
char boardingType, cardType;
printf("Enter Room Type:");
scanf("%d",&typeOfRoom);
if (typeOfRoom<1 || typeOfRoom>3)
{
printf("Invalid Room Type\n\n");
printf("Enter Room Type:");
scanf("%d" ,&typeOfRoom);
}
printf ("Enter Accommodation Basis (F/H):");
scanf(" %c", &boardingType);
printf ("Number of Days:");
scanf("%d",&days);
if (boardingType=='F')
{
if(typeOfRoom==1)
{
amount = 25555*days;
}
else if (typeOfRoom==2)
{
amount= 17500*days;
}
else if(typeOfRoom==3)
{
amount = 9000*days;
}
}
else if(boardingType=='H')
{
if (typeOfRoom==1)
{
amount= 17250*days;
}
else if (typeOfRoom==2)
{
amount= 12250*days;
}
else if (typeOfRoom==3)
{
amount= 7250*days;
}
}
else
{
printf("Invalid Accomodation Basis");
}
printf("Enter your reward card type (G/S/B):");
scanf(" %c",&cardType);
if(cardType=='G'|| cardType=='g')
{
discount = amount*0.125;
}
else if(cardType=='S'|| cardType=='s')
{
discount = amount*0.115;
}
else
{
discount= amount*0.095;
}
printf("Amount (Rs.): %.2f\n\n",amount-discount);
printf("Enter type of room:");
scanf("%d", &typeOfRoom);
return 0;
}