-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.cpp
417 lines (326 loc) · 10 KB
/
test.cpp
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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
#include <iostream>
#include <string>
#include <list>
using namespace std;
string username = "salonspa"; //username
string password = "54321"; //password
string inputUsername, inputPassword; //for admin
int tries = 0; //tries for admin
const int MAX_TRIES = 100; //admin MAX_TRIES
int action = 0; //Appointment
const int MAX_ACT = 100; //Appointment
char servtype, service, receipt, offer, treatment, promo, extra; //products
float price, pay, total, change;
struct Product { //products
string name;
float price;
float pay;
float change;
float total;
int i;
};
const int MAX_PRODUCTS = 100;
Product products[MAX_PRODUCTS];
int productCount = 0;
struct Appointment
{
string customerName;
string date;
string time;
};
const int MAX_APPOINTMENTS = 30;
Appointment appointments[MAX_APPOINTMENTS];
int numAppointments = 0;
void addAppointments();
void displayAppointments();
void searchAppointments();
void appointmentmenu();
int main ()
{
while (tries < MAX_TRIES) {
cout<<"Admin Username:";
cin>>inputUsername;
cout<<"Admin Password:";
cin>>inputPassword;
if (inputUsername == username && inputPassword == password) {
cout<<"SUCCESS!\n"<<endl;
appointmentmenu();
break;
}
else {
cout<<"ERROR! TRY AGAIN...\n"<<endl;
tries++;
}
}
if (tries == MAX_TRIES) {
cout<<"\nToo many failed attempts. \nExiting...."<<endl;
}
return 0;
}
void addProduct(string name, float price) {
if (productCount < MAX_PRODUCTS) {
products[productCount].name = name;
products[productCount].price = price;
products[productCount].total = total;
products[productCount].total = products[productCount].total + products[productCount].price;
products[productCount].pay = pay;
products[productCount].change = change;
productCount++;
}
break;
else {
cout << "Error: Product list is full." << endl;
}
}
void printProducts() {
for (int i = 0; i < productCount; i++) {
cout <<products[i].name << "\nTotal Price: Php" << products[i].total;
}
}
void computeProducts() {
for (int i = 0; i < productCount; i++) {
cout<<"\nCASH: ";
cin >> products[i].pay;
if (products[i].pay > products[i].total) {
products[i].change = products[i].pay - products[i].total;
cout<<"\nChange:" <<products[i].change<<endl;
}
else {
cout <<"Insufficient Payment!";
exit(0);
}
}
}
void addAppointments()
{
{
cout<<"\n*************************"<<endl;
cout<<"Type of service\n";
cout<<"\n\tA.Hair";
cout<<"\n\tB.Face";
cout<<"\n\tC.Nails/Feet";
cout<<"\n\tD.Body";
cout<<"\n\tE.Save Service" <<endl;
cout<<"\nEnter service: ";
cin>>servtype;
switch(servtype) {
case 'A':
cout<<"\n\tHAIR";
cout<<"\n\tOffer A: Classic";
cout<<"\n\tOffer B: STYLING & SETTING"<<endl;
cout<<"\nChoose Offer: """;
cin>>offer;
if (offer == 'A') {
cout<<"\n\tTrim";
cout <<"\n\tPrice: Php. 99.00";
cout<<endl;
cout<<"Promo? Y/N: ";
cin>>promo;
if (promo =='Y') {
price = 99 + 70;
addProduct("*HAIR*\n\tTrim\n\tSpecial Promo\n\tShampoo\n\tBlowdry\n\tHair Iron\n\tCurl", price );
cout<<endl;
}
else if (promo =='N') {
price = 99 + 0;
addProduct("*HAIR*\n\tTrim\n\tWithout Promo", price);
cout<<endl;
}
else {
cout<<"Invalid Option!\n";
}
}
else if (offer == 'B') {
addProduct("\n\tHAIR\n\tHighlights\n\tBrazilian\n\tRebonding\n\tCellophane", 1000.00 );
}
break;
case 'B':
cout<<"\n\tFace";
cout<<"\n\tA.Facial Classic";
cout <<"\n\tPrice: Php. 1599.00"<<endl;
cout<<"\n\tB.Facial Treatments:";
cout <<"\n\tPrice: Php. 1999.00"<<endl;
cout<<"\n\tChoose Offer: """;
cin>>offer;
if (offer == 'A') {
cout<<"\na.Deep cleansing";
cout<<"\nb.w vit. c";
cout<<"\nc.w vit. c + modelling mask";
cout<<"\nd.w collagen";
cout<<"\ne.w diamond";
cout <<"\nPrice: Php. 1599.00";
cout<<"\nExtra Offer? Y/N: ";
cin>>extra;
if (extra =='Y') {
addProduct("\n\tThreading or Microblading eyebrows\n\tEyelash extension\n\tSkin tag removal", 1599.00 );
}
else if (extra =='N') {
addProduct("\n\tFACE\n\tHighlights\n\tDeep cleansing\n\tw vit. c\n\tw vit. c + modelling mask\n\tw collagen\n\tw.diamond", 1599.00 );
cout<<endl;
break;
}
else {
cout<<"Invalid Option!\n";
}
}
else if (offer == 'B') {
cout<<"\nTreatment a: Acne Treatment";
cout<<"\nTreatment b: Melasma Treatment";
cout<<"\nTreatment c: Face Lifting (non-surgical)";
cout<<"\n Choose Treatment:";
cin>>treatment;
if (treatment == 'a') {
addProduct("\nFACE\nTreatment a: Acne Trmnt.\n\tMiamipeel w extraction\n\tFacial w extraction\n\tRadio frequency\n\tw collagen\n\tw.diamond", 1999.00 );
}
else if (treatment == 'b') {
addProduct("\nFACE\nTreatment b: Melasma Trmnt.\n\tMiamipeel\n\tMeso Theraphy", 1599.00 );
}
else if (treatment == 'c') {
addProduct("\nFACE\nTreatment a: Face Lifting (non-surgical)\n\tRadio frequency\n\tMeso Theraphy", 1599.00 );
}
else {
cout<<"Invalid!";
}
cout<<"Extra Offer? Y/N: ";
cin>>extra;
if (extra =='Y') {
addProduct("\nThreading or Microblading eyebrows\nEyelash extension\nSkin tag removal", 1599.00 );
}
else if (extra =='N') {
}
else {
cout<<"Invalid Option!\n";
}
}
break;
case 'C':
cout<<"\nNails/Feet";
cout<<"\nA.Classic Mani & Pedi";
cout<<"\nB.Nails Extension";
cout<<"\nC.FOOTSPA";
cout<<"\nChoose Offer: """;
cin>>offer;
if (offer == 'A') {
cout<<"\nA.Nail art";
cout<<"\nB.w gellish";
cout<<"\nPrice: Php. 99.00";
cout<<"\nExtra Offer? Y/N: ";
cin>>extra;
if (extra =='Y'){
price = 99 + 150;
addProduct("\nNails/Feet\nA.Nail art\nB.w gellish\nRemoval Nail gel (not done w us)", price );
}
else if (extra =='N') {
addProduct("\nNails/Feet\nA.Nail art\nB.w gellish", 99.00 );
}
else {
cout<<"Invalid Option!\n";
}
}
else if (offer == 'B') {
cout<<"\nAcrylic gel";
cout<<"\nAcrylic gel w french tip";
cout<<"\nNail Refill";
cout<<"\nPrice: Php. 150.00";
cout<<"\nExtra Offer? Y/N: ";
cin>>extra;
if (extra =='Y'){
price = 99 + 150;
addProduct("\nNails/Feet\nA.Acrylic gel\nB.Acrylic gel w french tip\nC.Nail Refill\nRemoval Nail gel (not done w us)", price );
}
else if (extra =='N') {
addProduct("\nNails/Feet\nA.Acrylic gel\nB.Acrylic gel w french tip\nC.Nail Refill", 99.00 );
}
else {
cout<<"Invalid Option!\n";
}
}
else if (offer == 'C') {
cout<<"\nFootspa";
cout<<"\nw Paraffin";
cout<<"\nw wax";
cout<<"\nPrice: Php. 150.00";
addProduct("\nNails/Feet\nA.Footspa\n\tw Paraffin\n\tw wax", 150.00 );
if (extra =='Y'){
price = 99 + 150;
addProduct("\nNails/Feet\nA.Footspa\n\tw Paraffin\n\tw wax\nRemoval Nail gel (not done w us)", price );
}
else if (extra =='N') {
addProduct("\nNails/Feet\nA.Footspa\n\tw Paraffin\n\tw wax", 150.00 );
}
else {
cout<<"Invalid Option!\n";
}
}
break;
case 'D':
addProduct("\nBody\nA.Whole body massage\nB.Massage w ventosa\nC.Sauna", 499.00 );
break;
case 'E':
break;
default: cout <<"INVALID CHOICE. PLEASE TRY AGAIN!" <<endl;
}
}
if(numAppointments == MAX_APPOINTMENTS) {
cout<<"Sorry"<<endl;
return;
} printProducts();
computeProducts();
cout<<"Enter the customer name: ";
cin>>appointments[numAppointments].customerName;
cout<<"Enter the date: ";
cin>>appointments[numAppointments].date;
cout<<"Enter the time: ";
cin>>appointments[numAppointments].time;
numAppointments++;
return;
}
void displayAppointments() {
cout<<"Current Appointments:\n ";
for (int i = 0; i<numAppointments; i++) {
cout<<"\n"<<appointments[i].customerName<<"\n"<<appointments[i].date<<"\n"<<appointments[i].time<<endl;
printProducts();
}
}
void searchAppointments() {
string date, time;
cout<<"Enter the date (mm/dd/yyy): ";
cin>>date;
cout<<"Enter the time (hh:mm): ";
cin>>time;
for (int i = 0; i < numAppointments; i++)
{
if (appointments[i].date == date && appointments[i].time == time) {
cout<<"Found Appointment: "<<endl;
cout<<appointments[i].customerName<<"\n"<<appointments[i].date<<"\n"<<appointments[i].time<<endl;
printProducts();
return;
}
}
cout<<"Opps. Sorry! No Appointment..."<<endl;
}
void appointmentmenu() {
while (true) {
cout<<"\n*************************"<<endl;
cout<<"\nGlamour Beauty Salon and Spa";
cout<<"\t\n1. Add Appointment";
cout<<"\t\n2. List of Appointment";
cout<<"\t\n3. Search for an Appointment";
cout<<"\t\n4. EXIT"<<endl;
int choice;
cout<<"\nEnter your choice: ";
cin>>choice;
switch(choice)
{
case 1: addAppointments();
break;
case 2: displayAppointments();
break;
case 3:searchAppointments();
break;
case 4:
break;
default: cout <<"INVALID CHOICE. PLEASE TRY AGAIN!" <<endl;
}
}
}