-
Notifications
You must be signed in to change notification settings - Fork 1
/
BoatingRental.c
289 lines (242 loc) · 14.9 KB
/
BoatingRental.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <windows.h>
#include <time.h>
#define Pedalboat1 100
#define Pedalboat2 200
#define Rowboat 170
#define motorboat 250
#define houseboat2 500
#define houseboat4 800
#define houseboat8 999
typedef struct
{
char Name[64];
char PhNo[16];
char IdType[32];
char IdNo[64];
int PassengerCount;
char BoatType[32];
int BoatCount;
char PaymentMethod[32];
time_t CheckInDatenTime;
char CheckOutDatenTime[16];
int BillAmount;
} BoatingSystem;
int main()
{
BoatingSystem bsys;
int i, billchoice, inpchoice, idtchoice, boattype, xbchoice, paychoice, tempchoice;
char username[8], password[8], ch1;
time_t now = time(NULL);
struct tm *co = localtime(&now);
system("cls");
printf("\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n\t\t\t\t\t\t\t\t\t| BOAT RENTAL SYSTEM |\n\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n");
printf("\n\t\t\t\t\t\t\t+==========+\n\t\t\t\t\t\t\t| Username |\n\t\t\t\t\t\t\t+==========+ : ");
scanf("%s", username);
printf("\n\t\t\t\t\t\t\t+==========+\n\t\t\t\t\t\t\t| Password |\n\t\t\t\t\t\t\t+==========+ : ");
scanf("%s", password);
system("cls");
if(strcmp(username,"Admin")==0 && strcmp(password,"Pass")==0)
{
do
{
FILE* fptr = fopen("Boating Rental History.txt", "a");
printf("\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n\t\t\t\t\t\t\t================| BOAT RENTAL SYSTEM |================\n\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n");
printf("\t\t\t\t\t\t\t+=====================+\n\t\t\t\t\t\t\t| 1. Continue Billing |\n\t\t\t\t\t\t\t| 2. Close Billing |\n\t\t\t\t\t\t\t+=====================+\n\t\t\t\t\t\t\t: ");
scanf("%d", &billchoice);
system("cls");
switch (billchoice)
{
case 1:
fflush(stdin);
printf("\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n\t\t\t\t\t\t\t================| BOAT RENTAL SYSTEM |================\n\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n");
printf("\n\t\t\t\t\t\t\t+======+\n\t\t\t\t\t\t\t| Name |\n\t\t\t\t\t\t\t+======+ : ");
gets(bsys.Name);
system("cls");
do
{
printf("\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n\t\t\t\t\t\t\t================| BOAT RENTAL SYSTEM |================\n\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n");
printf("\n\t\t\t\t\t\t\t+==============+\n\t\t\t\t\t\t\t| Phone Number |\n\t\t\t\t\t\t\t+==============+ : ");
scanf("%s", &bsys.PhNo);
system("cls");
} while (strlen(bsys.PhNo)!=10);
do {
printf("\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n\t\t\t\t\t\t\t================| BOAT RENTAL SYSTEM |================\n\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n");
printf("\n\t\t\t\t\t\t\t+========================+\n\t\t\t\t\t\t\t| ID Type:- |\n\t\t\t\t\t\t\t| --------- |\n\t\t\t\t\t\t\t| 1. Aadhaar |\n\t\t\t\t\t\t\t| 2. Driving License |\n\t\t\t\t\t\t\t| 3. Voter's ID |\n\t\t\t\t\t\t\t| 4. Service ID (Govt.) |\n\t\t\t\t\t\t\t| 5. Passport |\n\t\t\t\t\t\t\t| 6. Other |\n\t\t\t\t\t\t\t+========================+\n\t\t\t\t\t\t\t: ");
scanf("%d", &idtchoice);
switch (idtchoice)
{
case 1:
system("cls");
strcpy(bsys.IdType, "Aadhaar\0");
do {
printf("\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n\t\t\t\t\t\t\t================| BOAT RENTAL SYSTEM |================\n\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n");
printf("\n\t\t\t\t\t\t\t+===========+\n\t\t\t\t\t\t\t| ID Number |\n\t\t\t\t\t\t\t+===========+\n\t\t\t\t\t\t\t: ");
scanf("%s", &bsys.IdNo);
system("cls");
} while (strlen(bsys.IdNo) != 12);
break;
case 2:
strcpy(bsys.IdType, "Driving License\0");
do {
printf("\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n\t\t\t\t\t\t\t================| BOAT RENTAL SYSTEM |================\n\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n");
printf("\n\t\t\t\t\t\t\t+===========+\n\t\t\t\t\t\t\t| ID Number |\n\t\t\t\t\t\t\t+===========+\n\t\t\t\t\t\t\t: ");
scanf("%s", &bsys.IdNo);
system("cls");
} while (strlen(bsys.IdNo) != 15);
break;
case 3:
strcpy(bsys.IdType, "Voter's ID\0");
do {
printf("\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n\t\t\t\t\t\t\t================| BOAT RENTAL SYSTEM |================\n\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n");
printf("\n\t\t\t\t\t\t\t+===========+\n\t\t\t\t\t\t\t| ID Number |\n\t\t\t\t\t\t\t+===========+\n\t\t\t\t\t\t\t: ");
scanf("%s", &bsys.IdNo);
system("cls");
} while (strlen(bsys.IdNo) != 16);
break;
case 4:
strcpy(bsys.IdType, "Service ID (Govt.)\0");
break;
case 5:
strcpy(bsys.IdType, "Passport\0");
break;
case 6:
printf("\nID Type: ");
gets(bsys.IdType);
break;
default:
printf("\nINVALID INPUT!");
break;
}
system("cls");
} while (idtchoice>6);
fflush(stdin);
do {
printf("\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n\t\t\t\t\t\t\t================| BOAT RENTAL SYSTEM |================\n\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n");
printf("\n\t\t\t\t\t\t\t+=================+\n\t\t\t\t\t\t\t| Passenger Count |\n\t\t\t\t\t\t\t+=================+\n\t\t\t\t\t\t\t: ");
scanf("%d", &bsys.PassengerCount);
printf("\n\n\t\t\t\t\t\t\tConfirm?\n\t\t\t\t\t\t\t--------\n\t\t\t\t\t\t\t1. Yes\n\t\t\t\t\t\t\t2. No\n\t\t\t\t\t\t\t: ");
scanf("%d", &tempchoice);
fflush(stdin);
system("cls");
} while (tempchoice!=1);
system("cls");
do {
do {
printf("\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n\t\t\t\t\t\t\t================| BOAT RENTAL SYSTEM |================\n\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n");
printf("\n\t\t\t\t\t\t\t+===================+\n\t\t\t\t\t\t\t| Boat Type:- |\n\t\t\t\t\t\t\t| ----------- |\n\t\t\t\t\t\t\t| 1. Pedal Boat (2) |\n\t\t\t\t\t\t\t| 2. Pedal Boat (4) |\n\t\t\t\t\t\t\t| 3. Row Boat (4) |\n\t\t\t\t\t\t\t| 4. Motor Boat (8) |\n\t\t\t\t\t\t\t| 5. House Boat (2) |\n\t\t\t\t\t\t\t| 6. House Boat (4) |\n\t\t\t\t\t\t\t| 7. House Boat (8) |\n\t\t\t\t\t\t\t+===================+\n\t\t\t\t\t\t\t: ");
scanf("%d", &boattype);
switch (boattype)
{
case 1:
strcpy(bsys.BoatType, "Pedal Boat (2)");
break;
case 2:
strcpy(bsys.BoatType, "Pedal Boat (4)");
break;
case 3:
strcpy(bsys.BoatType, "Row Boat (4)");
break;
case 4:
strcpy(bsys.BoatType, "Motor Boat (8)");
break;
case 5:
strcpy(bsys.BoatType, "House Boat (2)");
break;
case 6:
strcpy(bsys.BoatType, "House Boat (4)");
break;
case 7:
strcpy(bsys.BoatType, "House Boat (8)");
break;
default:
printf("INVALID INPUT!");
break;
}
system("cls");
} while (boattype>7);
printf("\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n\t\t\t\t\t\t\t================| BOAT RENTAL SYSTEM |================\n\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n");
printf("\n\t\t\t\t\t\t\t+============+\n\t\t\t\t\t\t\t| Boat Count |\n\t\t\t\t\t\t\t+============+\n\t\t\t\t\t\t\t: ");
scanf("%d", &bsys.BoatCount);
printf("\n\n\t\t\t\t\t\t\tConfirm?\n\t\t\t\t\t\t\t--------\n\t\t\t\t\t\t\t1. Yes\n\t\t\t\t\t\t\t2. No\n\t\t\t\t\t\t\t: ");
scanf("%d", &tempchoice);
system("cls");
} while (tempchoice!=1);
if (strcmp(bsys.BoatType, "Pedal Boat (2)") == 0)
{
bsys.BillAmount = bsys.BoatCount * Pedalboat1;
}
else if (strcmp(bsys.BoatType, "Pedal Boat (4)") == 0)
{
bsys.BillAmount = bsys.BoatCount * Pedalboat2;
}
else if (strcmp(bsys.BoatType, "Row Boat (4)") == 0)
{
bsys.BillAmount = bsys.BoatCount * Rowboat;
}
else if (strcmp(bsys.BoatType, "Motor Boat (8)") == 0)
{
bsys.BillAmount = bsys.BoatCount * motorboat;
}
else if (strcmp(bsys.BoatType, "House Boat (2)") == 0)
{
bsys.BillAmount = bsys.BoatCount * houseboat2;
}
else if (strcmp(bsys.BoatType, "House Boat (4)") == 0)
{
bsys.BillAmount = bsys.BoatCount * houseboat4;
}
else if (strcmp(bsys.BoatType, "House Boat (8)") == 0)
{
bsys.BillAmount = bsys.BoatCount * houseboat8;
}
do {
printf("\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n\t\t\t\t\t\t\t================| BOAT RENTAL SYSTEM |================\n\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n");
printf("\n\t\t\t\t\t\t\t| Bill Amount : Rs. %d |\n", bsys.BillAmount);
printf("\n\t\t\t\t\t\t\t+==================+\n\t\t\t\t\t\t\t| Payment Method:- |\n\t\t\t\t\t\t\t| ---------------- |\n\t\t\t\t\t\t\t| 1. Cash |\n\t\t\t\t\t\t\t| 2. UPI |\n\t\t\t\t\t\t\t| 3. Card |\n\t\t\t\t\t\t\t+==================+\n\t\t\t\t\t\t\t: ");
scanf("%d", &paychoice);
switch (paychoice)
{
case 1:
strcpy(bsys.PaymentMethod, "Cash\0");
break;
case 2:
strcpy(bsys.PaymentMethod, "UPI\0");
break;
case 3:
strcpy(bsys.PaymentMethod, "Card\0");
break;
default:
break;
}
printf("\n\n\t\t\t\t\t\t\tConfirm?\n\t\t\t\t\t\t\t--------\n\t\t\t\t\t\t\t1. Yes\n\t\t\t\t\t\t\t2. No\n\t\t\t\t\t\t\t: ");
scanf("%d", &tempchoice);
system("cls");
} while (tempchoice!=1);
time(&bsys.CheckInDatenTime);
system("cls");
fflush(stdin);
printf("\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n\t\t\t\t\t\t\t================| BOAT RENTAL SYSTEM |================\n\t\t\t\t\t\t\t\t\t+~~~~~~~~~~~~~~~~~~~~+\n");
printf("\n\t\t\t\t\t\t\t+=========================+\n\t\t\t\t\t\t\t| Check-Out Date and Time |\n\t\t\t\t\t\t\t+=========================+\n\t\t\t\t\t\t\t: ");
gets(bsys.CheckOutDatenTime);
system("cls");
fprintf(fptr, "\n\nName : %s\nPhone Number : %s\nID Type : %s\nID Number : %s\nPassenger Count : %d\nBoat Type : %s\nBoat Count : %d\nCheck-In Date & Time : %sCheck-Out Date : %s\nBill Amount : %d\nPayment Method : %s", bsys.Name, bsys.PhNo, bsys.IdType, bsys.IdNo, bsys.PassengerCount, bsys.BoatType, bsys.BoatCount, ctime(&bsys.CheckInDatenTime), bsys.CheckOutDatenTime, bsys.BillAmount, bsys.PaymentMethod);
fclose(fptr);
break;
case 2:
printf("\nAPPLICATION CLOSING...\n\nAPPLICATION SUCCESSFULLY CLOSED!");
break;
default:
printf("INVALID INPUT!");
break;
}
} while (billchoice != 2);
}
else
{
printf("\n!! EITHER YOUR USERNAME OR PASSWORD IS INVALID !!");
}
}