-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gym Software v2.cpp
583 lines (496 loc) · 20.9 KB
/
Gym Software v2.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
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
/*
Beykoz University - Computer Enginerring
Name: Mert Altuntas
ID : 1804010005
For Login System;
username = "Mert"
password = "1234"
*/
#include <stdio.h>
#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
using namespace std;
int main();
class Credential {
public:
void payment_methods() {
system("cls");
printf("\n=============================================================\n");
printf("\n\n\t\tPAYMENT METHODS AND DISCOUNTS\n\n");
printf("\n\tA- Fitness / Normal Membership : 1 Mounth (5 days a week)- 20$");
printf("\n\tB- Fitness / Normal Membership : 1 Mounth (3 days a week)- 15$");
printf("\n\tC- Fitness / Student Discount : 1 Mounth (3 days a week)- 10$\n");
printf("\n\tD- Swimming / Normal Membership : 1 Mounth (5 days a week)- 25$");
printf("\n\tE- Swimming / Normal Membership : 1 Mounth (3 days a week)- 20$");
printf("\n\tF- Swimming / Student Discount : 1 Mounth (3 days a week)- 15$\n");
printf("\n\tG- Fitness and Swimming / Normal Membership : 1 Mounth (5 days a week)- 40$");
printf("\n\tH- Fitness and Swimming / Normal Membership : 1 Mounth (3 days a week)- 30$");
printf("\n\tI- Fitness and Swimming / Student Discount : 1 Mounth (3 days a week)- 20$");
printf("\n\n=============================================================\n\n");
printf("Press any key to return to main menu..\n");
getch();
system("cls");
main();
}
void signupFunction() {
string username;
string password;
system("cls");
printf("\nChoose an username : \n");
scanf("%s", & username);
printf("Choose a numeric password : \n"),
scanf("%s", & password);
printf("\n ***Your account ready to use. Please go back.*** \n");
loginFunction();
}
//--------------------------------------------------------------------------------------------------------------------------
void loginFunction() {
system("cls");
char username[200] = "Mert";
char password[200] = "1234";
char userName[200];
char passWord[200];
tekrar:
printf("\nPlease enter username: \t");
scanf("%s", & userName);
printf("\nPlease enter numeric password : ");
scanf("%s", & passWord);
if (strcmp(username, userName) == 0 && strcmp(password, passWord) == 0) {
printf("\n\nLogin successful. Press any key to continue.\n");
//Access granted ;
getch();
x:
system("cls");
int secim2;
printf("\n=============================================================\n");
printf("\n\n\t\tMEMBER MANAGEMENT");
printf("\n\n\tPlease choose what do you want : ");
printf("\n\t1.Delete a member.");
printf("\n\t2.View list of all members.");
printf("\n\n=============================================================\n\n");
printf("\n\n\tENTER YOUR CHOICE:\t");
scanf("%d", & secim2);
if (secim2 == 2) //displaying members.txt on screen*****************************************************************
{
system("cls");
FILE * dosya;
char character;
dosya = fopen("MemberList.txt", "r");
if (dosya != NULL) {
character = fgetc(dosya);
while (character != EOF) {
printf("%c", character);
character = fgetc(dosya);
}
}
/* actually i wanted to use this method but its not seen good :(
system ("cls");
FILE * dosya;
char isimler [500][30], soyisimler [500][30], branchs[500][30], options[500][10];
int i=0;
dosya = fopen("MemberList.txt" , "r");
if(dosya!=NULL)
{
while(!feof(dosya))
{
fscanf(dosya,"%s %s %s %s",&isimler[i], &soyisimler[i], &branchs[i] );
printf("%s %s : %s - Option %s\n",isimler[i], soyisimler[i], branchs[i]);
}
}
*/
else {
printf("\nFile does not exist. Try Again.");
goto x;
}
fclose(dosya);
printf("\nPress any key to return to the main menu.");
getch();
system("cls");
main();
} else if (secim2 == 1) //deleting member according to name***********************************************************************
{
FILE * dosya;
char isimler[30], soyisimler[30], branchs[30], options[10];
char mem[20], adrs[25], id[30];
int ag, cono, count = 0;
FILE * fp;
dosya = fopen("Memberlist.txt", "r");
fp = fopen("NewMemberlist.txt", "w");
printf("\nEnter the name of member: \n");
getchar();
gets(mem);
while (!feof(dosya)) {
fscanf(dosya, "%s%s%s", & isimler, & soyisimler, & branchs);
if (strcmp(isimler, mem) != 0) {
fprintf(fp, "%s %s %s\n", isimler, soyisimler, branchs);
} else if (strcmp(isimler, mem) == 0) {
printf("\nDetails of the deleted member is:\n");
printf("Name : %s\nSurname : %s\nBranch : %s\n", isimler, soyisimler, branchs);
} else {
printf("\nPlease enter the correct details\n");
}
}
fclose(dosya);
fclose(fp);
dosya = fopen("Memberlist.txt", "w");
fp = fopen("NewMemberlist.txt", "r");
while (!feof(fp)) {
fscanf(fp, "%s %s %s", & isimler, & soyisimler, & branchs);
fprintf(dosya, "%s %s %s\n", isimler, soyisimler, branchs);
}
fclose(fp);
fclose(dosya);
}
getch();
system("cls");
main();
} else {
printf("\n\nWrong username or password.\nPlease try again or sign up.\n");
goto tekrar;
}
}
};
class Member {
public:
//--------------------------------------------------------------------------------------------------------------------------
void new_member() {
system("cls");
char isim[30], soyisim[30], branch[30], paymentMethod[10];
printf("\nEnter Name : \t");
scanf("%s", isim);
printf("\nEnter Surname : ");
scanf("%s", soyisim);
printf("\nEnter Main Branch : ");
scanf("%s", branch);
printf("\n\nChoose a payment method : ");
printf("\n=============================================================\n");
printf("\n\n\t\tPAYMENT METHODS AND DISCOUNTS\n\n");
printf("\n\tA- Fitness / Normal Membership : 1 Mounth (5 days a week)- 20$");
printf("\n\tB- Fitness / Normal Membership : 1 Mounth (3 days a week)- 15$");
printf("\n\tC- Fitness / Student Discount : 1 Mounth (3 days a week)- 10$\n");
printf("\n\tD- Swimming / Normal Membership : 1 Mounth (5 days a week)- 25$");
printf("\n\tE- Swimming / Normal Membership : 1 Mounth (3 days a week)- 20$");
printf("\n\tF- Swimming / Student Discount : 1 Mounth (3 days a week)- 15$\n");
printf("\n\tG- Fitness and Swimming / Normal Membership : 1 Mounth (5 days a week)- 40$");
printf("\n\tH- Fitness and Swimming / Normal Membership : 1 Mounth (3 days a week)- 30$");
printf("\n\tI- Fitness and Swimming / Student Discount : 1 Mounth (3 days a week)- 20$");
printf("\n\n=============================================================\n\n");
printf("Enter the choice with Letter : \t");
scanf("%s", paymentMethod);
FILE * f;
f = fopen("MemberList.txt", "a");
fprintf(f, "%s %s %s\n", isim, soyisim, branch);
fclose(f);
printf("\nPress any key to return to the main menu.");
getch();
system("cls");
main();
}
//--------------------------------------------------------------------------------------------------------------------------
void member_management() {
Credential credential;
system("cls");
int secim;
printf("\n=============================================================\n");
printf("\n\n\t\tADMINISTRATIVE LOGIN PAGE");
printf("\n\n\t1.Login to system with username and password.");
printf("\n\t2.Sign-up to system.");
printf("\n\n=============================================================\n\n");
printf("\n\n\tENTER YOUR CHOICE:\t");
scanf("%d", & secim);
switch (secim) {
case 1:
credential.loginFunction();
break;
case 2:
credential.signupFunction();
break;
default:
printf("\nWrong choice. Please try again.\n");
break;
}
}
};
class Intro {
public:
//--------------------------------------------------------INTRO------------------------------------------------------------------
void intro_ekrani() {
printf("\n----------------------------------\n");
printf("| Software Engineering Project |");
printf("\n----------------------------------\n");
printf("| Made By: Mert Altuntas |");
printf("\n----------------------------------\n");
printf("|\t ID: 1804010005 |");
printf("\n----------------------------------\n\n\n");
printf("Loading ");
int j, a;
for (a = 0; a <= 5; a++) {
printf(".");
for (j = 0; j <= 120000000; j++);
}
system("cls");
}
};
class Gym {
public:
//--------------------------------------------------------------------------------------------------------------------------
void workout() {
int c, u;
system("cls");
printf("\n\n\n\n");
printf("\t ****** BE THE BEAST AND WORK HARD *******\n\n\n");
printf("\t ****** ALWAYS HEALTH COMES FIRST *******\n\n\n");
printf("\t ****** PRESS ANY KEY TO SELECT THE WORK OUT *******\n\n\n");
getch();
system("cls");
z:
printf("\n\n\n\n\n\n");
printf("\tPRE-WORKOUT EXERCISE ARE COMPLUSORY\n\n\n");
printf("\t1 : CHEST WORKOUT\n\n");
printf("\t2 : BACK WORKOUT\n\n");
printf("\t3 : BICEPS WORKOUT\n\n");
printf("\t4 : TRICEPS WORKOUT\n\n");
printf("\t5 : ABS WORKOUT\n\n");
printf("\t6 : SHOULDER WORKOUT\n\n");
printf("\t7 : LEGS\n\n");
printf("\t8 : BACK TO MAIN MENU\n\n");
printf("\t");
scanf("%d", & c);
system("cls");
switch (c) {
case 1:
printf("\n");
printf("\t PUSH UP: 3 SETS; 15,12,10 REPS\n\n");
printf("\t INCLINED BENCH-PRESS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t FLAT BENCH-PRESS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t DECLINED BENCH-PRESS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t INCLIDE DUMBBELL-PRESS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t FLAT DUMBELL-PRESS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t DECLINED DUMBELL-PRESS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t CABLE CROSS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t SEATED MACHINE FLY: 3 SETS; 15,12,10 REPS\n\n");
printf("\t PLEASE DONT LIFT OVER-WEIGHT\n\n\n\n\n");
printf("\t TO RETURN TO WORKOUT LIST PLEASE PRESS '2' ");
scanf("%d", & u);
if (u == 2) {
system("cls");
goto z;
} else
break;
case 2:
printf("\n");
printf("\t WIDE GRIP PULL-UP: 3 SETS; 15,12,10 REPS\n\n");
printf("\t LAT PULL DOWN BACK: 3 SETS; 15,12,10 REPS\n\n");
printf("\t T-BAR: 3 SETS; 15,12,10 REPS\n\n");
printf("\t SEATED RAW: 3 SETS; 15,12,10 REPS\n\n");
printf("\t PULL DOWN ROW: 3 SETS; 15,12,10 REPS\n\n");
printf("\t ONR ARM DUMBBELL ROWS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t BARBELL BENT OVER: 3 SETS; 15,12,10 REPS\n\n");
printf("\t DEAD LIFT: 3 SETS; 15,12,10 REPS\n\n");
printf("\t PLEASE DONT LIFT OVER-WEIGHT\n\n\n");
printf("\t TO RETURN TO WORKOUT LIST PLEASE PRESS '2' ");
scanf("%d", & u);
if (u == 2) {
system("cls");
goto z;
} else
break;
case 3:
printf("\n");
printf("\t SMALL GRIP PULL-UP: 3 SETS; 15,12,10 REPS\n\n");
printf("\t PREACHER CURLS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t BARBELL CURLS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t ONE BY ONE DUMBELL CURL: 3 SETS; 15,12,10 REPS\n\n");
printf("\t CONCENTRATION CURLS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t CABLE BICEPS CURLS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t INCLINED DUMBELL CURLS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t REVERSE CURLS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t HAMMER CURLS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t PLEASE DONT LIFT OVER-WEIGHT\n\n\n\n");
printf("\t TO RETURN TO WORKOUT LIST PLEASE PRESS '2' ");
scanf("%d", & u);
if (u == 2) {
system("cls");
goto z;
} else
break;
case 4:
printf("\n");
printf("\t DIAMOND PUSH-UP: 3 SETS; 15,12,10 REPS\n\n");
printf("\t FLAT BAR TRICEPS EXTENSION: 3 SETS; 15,12,10 REPS\n\n");
printf("\t BAR TRICEPS EXTENSION: 3 SETS; 15,12,10 REPS\n\n");
printf("\t ONE ARM DUMBELL PRESS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t BOTH ARM DUMBELL PRESS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t KICKBACK: 3 SETS; 15,12,10 REPS\n\n");
printf("\t CABLE PUSH DOWN: 3 SETS; 15,12,10 REPS\n\n");
printf("\t CABLE PUSH OVERHEAD: 3 SETS; 15,12,10 REPS\n\n");
printf("\t TRICEPS DIPS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t PLEASE DONT LIFT OVER-WEIGHT\n\n\n");
printf("\t TO RETURN TO WORKOUT LIST PLEASE PRESS '2' ");
scanf("%d", & u);
if (u == 2) {
system("cls");
goto z;
} else
break;
case 5:
printf("\n");
printf("\t HANGING LEG RAISE: 3 SETS; 15,12,10 REPS\n\n");
printf("\t MACHINE CRUNCH: 3 SETS; 15,12,10 REPS\n\n");
printf("\t CABLE PALLOF PRESS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t KNEELING CABLE CRUNCH: 3 SETS; 15,12,10 REPS\n\n");
printf("\t DECLINE-BENCH CRUNCH WITH MEDICINE BALL: 3 SETS; 15,12,10 REPS\n\n");
printf("\t EXERCISE BALL PIKE: 3 SETS; 15,12,10 REPS\n\n");
printf("\t PLANK: 7,5,3 MINUTES\n\n");
printf("\t PLEASE DONT LIFT OVER-WEIGHT\n\n\n");
printf("\t TO RETURN TO WORKOUT LIST PLEASE PRESS '2' ");
scanf("%d", & u);
if (u == 2) {
system("cls");
goto z;
} else
break;
case 6:
printf("\n");
printf("\t BAREBELL FRONT PRESS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t DUMBELL PRESS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t LATERAL RAISES: 3 SETS; 15,12,10 REPS\n\n");
printf("\t FRONT PRESS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t DUMBELL BENT OVER: 3 SETS; 15,12,10 REPS\n\n");
printf("\t UPRIGHT ROW: 3 SETS; 15,12,10 REPS\n\n");
printf("\t SHRUG: 3 SETS; 15,12,10 REPS\n\n");
printf("\t PLEASE DONT LIFT OVER-WEIGHT\n\n");
printf("\t TO RETURN TO WORKOUT LIST PLEASE PRESS '2' ");
scanf("%d", & u);
if (u == 2) {
system("cls");
goto z;
} else
break;
case 7:
printf("\n");
printf("\t SET-UPS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t SUMO DUMBELL SQUATS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t LUNGES DUMBELLS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t SEATED LEGS CRULS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t SEATED MACHINE EXTENSIONS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t STANDING DUMBELL CALF: 3 SETS; 15,12,10 REPS\n\n");
printf("\t REVERSE LEGS CRULS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t HEAVY LEG PRESS: 3 SETS; 15,12,10 REPS\n\n");
printf("\t PLEASE DONT LIFT OVER-WEIGHT\n\n");
printf("\t TO RETURN TO WORKOUT LIST PLEASE PRESS '2' ");
scanf("%d", & u);
if (u == 2) {
system("cls");
goto z;
} else
break;
case 8:
main();
break;
}
}
void rules() {
system("cls");
printf("\t\t=============================================================\n");
printf("\n\t\t RULES AND REGULATIONS \n");
printf("\t\t=============================================================\n");
printf("\n\t1.Do not bring your gym bag or other personal belongings onto the fitness floor.\n");
printf("\t2.Refrain from yelling, using profanity, banging weights and making loud sounds\n");
printf("\t3.Do not sit on machines between sets\n");
printf("\t4.Re-rack weights and return all other equipment and accessories to their proper locations\n");
printf("\t5.Ask staff to show you how to operate equipment properly so that others are not waiting as you figure it out.\n");
printf("\t6.Wipe down all equipment after use.\n");
printf("\t7.Stick to posted time limits on all cardiovascular machines.\n");
printf("\t8.Do not bring children onto the gym floor. Children must remain in the childcare area.\n");
printf("\t9.Do not disturb others. Focus on your own workout and allow others to do the same.\n");
printf("\t10.Before beginning your workout, wash your hands and wipe off any cologne or perfume.\n\n");
printf("\n\tPRESS ANY KEY TO BACK MAIN MENU\n");
getch();
system("cls");
main();
}
void bmi_calculation() {
system("cls");
float height, weight, bmi = 0;
int age;
printf("\nPlease enter weight (kg): \n");
scanf("%f", & weight);
printf("Please enter height (dot m): \n");
scanf("%f", & height);
bmi = weight / (height * height);
if (bmi < 18.50) {
printf("\n\nYou are below your ideal weight.\n\n");
printf("The result is : %.2f\n\n", bmi);
} else if (bmi >= 18.50 && bmi < 24.99) {
printf("\n\nYour weight is ideal.\n\n");
printf("The result is : %.2f\n\n", bmi);
} else if (bmi > 25) {
printf("\n\nYou are above your ideal weight.\n\n");
printf("The result is : %.2f\n\n", bmi);
}
printf("Press any key to return to the main menu.\n");
getch();
system("cls");
main();
}
};
class MainMenu {
Intro intro;
Member member;
Credential credential;
Gym gym;
public:
void mainMenu(void) {
system("COLOR 1F");
intro.intro_ekrani();
int rakam;
printf("\n=============================================================\n");
printf("\n\n\t\tWELCOME TO GYM MANAGEMENT SOFTWARE");
printf("\n\n\t1. CREATE A NEW MEMBER");
printf("\n\t2. MEMBER MANAGEMENT (requires admin login)");
printf("\n\t3. WORKOUT PROGRAM SUGGESTION");
printf("\n\t4. RULES AND REGULATIONS");
printf("\n\t5. REVIEW PAYMENT METHODS & DISCOUNTS");
printf("\n\t6. MAKE A BMI CALCULATION");
printf("\n\t7. EXIT");
printf("\n\n=============================================================\n\n");
printf("\n\n\tENTER YOUR CHOICE:\t");
scanf("%d", & rakam);
switch (rakam) {
case 1:
member.new_member();
break;
case 2:
member.member_management();
break;
case 3:
gym.workout();
break;
case 4:
gym.rules();
break;
case 5:
credential.payment_methods();
break;
case 6:
gym.bmi_calculation();
break;
case 7:
printf("\n\n\tTHANK YOU\n");
exit(0);
break;
default:
printf("\nWrong choise. Please enter the correct numbers to use program.\n");
break;
}
}
};
//--------------------------------------------------------MAIN-------------------------------------------------------------------
int main() {
MainMenu mainMenu;
mainMenu.mainMenu();
}