Skip to content

Commit 63fb71a

Browse files
committed
Create hotel_billing_system.c
1 parent c1d0bc5 commit 63fb71a

File tree

1 file changed

+174
-0
lines changed

1 file changed

+174
-0
lines changed

hotel_billing_system.c

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
/*
2+
Problem Statement: Develop a C program that simulates a restaurant menu where the user can choose from Starters, Main Course,
3+
and Sweets, place multiple orders, and receive a final bill with CGST and SGST calculations.
4+
*/
5+
6+
#include <stdio.h>
7+
8+
int main()
9+
{
10+
int c, ch1, ch2, ch3;
11+
int total = 0;
12+
float cgst, sgst, finaltotal;
13+
int cnt = 0;
14+
15+
menu:
16+
17+
printf("\n\t-------Hotel Menu-------");
18+
printf("\n1. Starter. \n2. Main Course. \n3. Sweets.");
19+
printf("\nEnter your choice: ");
20+
scanf("%d", &ch1);
21+
22+
if (ch1 == 1)
23+
{
24+
starter:
25+
26+
printf("\n\t-------Starter-------");
27+
printf("\n1. Chicken Chilly \t:\t 175 \n2.Chicken 65 \t\t:\t 150 \n3.Chicken Lollypop \t:\t 200 ");
28+
printf("\nEnter your choice: ");
29+
scanf("%d", &ch2);
30+
31+
if (ch2 == 1)
32+
{
33+
cnt++;
34+
total = total + 175;
35+
printf("%d order is confirmed.", cnt);
36+
}
37+
else if (ch2 == 2)
38+
{
39+
cnt++;
40+
total = total + 150;
41+
printf("%d order is confirmed.", cnt);
42+
}
43+
else if (ch2 == 3)
44+
{
45+
cnt++;
46+
total = total + 200;
47+
printf("%d order is confirmed.", cnt);
48+
}
49+
else
50+
{
51+
printf("\nInvalid Choice!!!");
52+
}
53+
54+
printf("\nDo you want to continue with starter(Press 1): ");
55+
scanf("%d", &c);
56+
if (c == 1)
57+
{
58+
goto starter;
59+
}
60+
}
61+
else if (ch1 == 2)
62+
{
63+
maincourse:
64+
65+
printf("\n\t-------Main Course-------");
66+
printf("\n1. Chicken Handi \t:\t 325 \n2. murgh musallam \t:\t 800 \n3. Biryani \t:\t 400 \n4. Roti \t:\t 25 ");
67+
printf("\nEnter your choice: ");
68+
scanf("%d", &ch2);
69+
70+
if (ch2 == 1)
71+
{
72+
cnt++;
73+
total = total + 325;
74+
printf("%d order is confirmed.", cnt);
75+
}
76+
else if (ch2 == 2)
77+
{
78+
cnt++;
79+
total = total + 800;
80+
printf("%d order is confirmed.", cnt);
81+
}
82+
else if (ch2 == 3)
83+
{
84+
cnt++;
85+
total = total + 400;
86+
printf("%d order is confirmed.", cnt);
87+
}
88+
else if (ch2 == 4)
89+
{
90+
cnt++;
91+
total = total + 25;
92+
printf("%d order is confirmed.", cnt);
93+
}
94+
else
95+
{
96+
printf("\nInvalid Choice!!!");
97+
}
98+
99+
printf("\nDo you want to continue with Main Course(Press 1): ");
100+
scanf("%d", &c);
101+
if (c == 1)
102+
{
103+
goto maincourse;
104+
}
105+
}
106+
else if (ch1 == 3)
107+
{
108+
sweet:
109+
110+
printf("\n\t-------Sweets-------");
111+
printf("\n1. Ice cream \t:\t 75 \n2. Gullab Jamun \t:\t 50 \n3. Rasmalai \t:\t 100 ");
112+
printf("\nEnter your choice: ");
113+
scanf("%d", &ch2);
114+
115+
if (ch2 == 1)
116+
{
117+
cnt++;
118+
total = total + 75;
119+
printf("%d order is confirmed.", cnt);
120+
}
121+
else if (ch2 == 2)
122+
{
123+
cnt++;
124+
total = total + 50;
125+
printf("%d order is confirmed.", cnt);
126+
}
127+
else if (ch2 == 3)
128+
{
129+
cnt++;
130+
total = total + 100;
131+
printf("%d order is confirmed.", cnt);
132+
}
133+
else
134+
{
135+
printf("\nInvalid Choice!!!");
136+
}
137+
138+
printf("\nDo you want to continue with Sweets(Press 1): ");
139+
scanf("%d", &c);
140+
if (c == 1)
141+
{
142+
goto sweet;
143+
}
144+
}
145+
else
146+
{
147+
printf("\nInvalid Choice!!!");
148+
}
149+
150+
printf("\nDo you want to continue with Menu(Press 1): ");
151+
scanf("%d", &ch3);
152+
if (ch3 == 1)
153+
{
154+
goto menu;
155+
}
156+
157+
if (cnt > 0)
158+
{
159+
cgst = total * 0.06;
160+
cgst = total * 0.06;
161+
finaltotal = total + cgst + sgst;
162+
163+
printf("\n\t---------------BILL---------------");
164+
printf("\n\t\tTotal \t\t:\t %d", total);
165+
printf("\n\t\tCGST \t\t:\t %f", cgst);
166+
printf("\n\t\tSGST \t\t:\t %f", sgst);
167+
printf("\n\t\tFinal Total \t:\t %f", total);
168+
}
169+
else
170+
{
171+
printf("No order found.");
172+
}
173+
printf("\n\t-------Thank you-------");
174+
}

0 commit comments

Comments
 (0)