-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
802 lines (713 loc) · 23.2 KB
/
main.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
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
#include "user.h"
#include "Nutrition.h"
#include "Workout.h"
#include <iostream>
#include <string>
#include <Windows.h>
#include <cstdlib>
#include <iomanip>
#include <stdexcept>
using namespace std;
int main() {
User U;
Nutrition N;
Workout W;
string fitnessGoal, strengthLevel, muscleGroup;
int duration, speed;
int caloriesBurned = 0;
//Predefined Meals
N.addMeals("chicken", 165, 31);
N.addMeals("beef", 250, 26);
N.addMeals("eggs", 155, 13);
N.addMeals("apple", 52, 0);
N.addMeals("banana", 89, 1);
// Welcome message
cout << "\033[32mWELCOME to your fitness journey! Ready to sweat and smile?\n"
<< "Please enter the below information for us to help you get started!\033[0m\n" << endl;
// registring User
cout << "-Enter your First Name: ";
U.SetName();
cout << "\n-Enter your Gender \033[33m(male/female)\033[0m: ";
U.SetGender();
cout << "\n-Enter your Age: ";
U.SetAge();
cout << "\n-Enter your Height \033[33m(meters)\033[0m: ";
U.Setheight();
cout << "\n-Enter your Weight \033[33m(kg)\033[0m: ";
U.Setweight();
U.Calculate_BMI();
// Setting the user's nutrition information
N.setPerson(U);
N.SetCalorieIntake(U);
N.SetProteinIntake(U);
N.SetWaterIntake(U);
system("cls");
int choice = 1;
// main loop, until user enter 0 to exit
while (choice != 0) {
int muscleChoice = 1;
int activityChoice = 1;
cout << "\033[30;43mFITNESS TRACKER\033[1;0m\n" << endl;
cout << "\033[33mChoose what you want to do:(enter the number)\033[1;0m\n";
cout
<< "1. Display Profile\n"
<< "2. Update Profile\n"
<< "3. Get Nutrition Help\n"
<< "4. Get a Workout Plan\n"
<< "5. Execute Workout\n"
<< "0. \033[31mExit program\033[0m\n\n"
<< "--> ";
cin >> choice; // let user choose based on previous list
switch (choice) {
case 1: {
// Display user profile
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
U.DisplayProfile();
int key0;
cout << "\n\033[33m>>> Press 0 to Continue:\033[0m ";
cin >> key0;
//Clear terminal and go back to begining of while loop
system("cls");
break;
}
case 2: {
// Update profile
int choice2 = 1;
while (choice2 != 0) { //loop untill user chooses to go back by entering 0
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl
<< "\033[34;47m> Update Profile\033[1;0m\n" << endl
<< "\033[33mChoose what you want to update:\033[1;0m\n";
cout << "1. Update Name\n"
<< "2. Update Weight\n"
<< "3. Update Height\n"
<< "4. Update Age\n"
<< "5. Update Gender\n"
<< "0. \033[31mGo Back\033[0m\n\n"
<< "--> ";
cin >> choice2; // let user choose based on previous list
switch (choice2) {
case 1: {
// Update name
cout << "Enter your name: ";
U.UpdateName();
cout << "\033[32mName Successfully Updated!\033[0m" << endl;
//Clear terminal and go back to begining of while loop
Sleep(1000);
system("cls");
break;
}
case 2: {
// Update weight
cout << "Enter your Weight \033[33m(Kg)\033[0m: ";
U.UpdateWeight();
/*
Update all the nutrition information because the
user changed the weight which affects the daily
calorie and protein and water intake
*/
N.setPerson(U);
N.SetCalorieIntake(U);
N.SetProteinIntake(U);
N.SetWaterIntake(U);
cout << "\033[32mWeight Successfully Updated!\033[0m" << endl;
//Clear terminal and go back to begining of while loop
Sleep(1000);
system("cls");
break;
}
case 3: {
// Update height
cout << "Enter your Height \033[33m(meters)\033[0m: ";
U.UpdateHeight();
/*
Update all the nutrition information because the
user changed the weight which affects the daily
calorie and protein and water intake
*/
N.setPerson(U);
N.SetCalorieIntake(U);
N.SetProteinIntake(U);
N.SetWaterIntake(U);
cout << "\033[32mHeight Successfully Updated!\033[0m" << endl;
//Clear terminal and go back to begining of while loop
Sleep(1000);
system("cls");
break;
}
case 4: {
// Update age
cout << "Enter Your Age: ";
U.UpdateAge();
/*
Update all the nutrition information because the
user changed the weight which affects the daily
calorie and protein and water intake
*/
N.setPerson(U);
N.SetCalorieIntake(U);
N.SetProteinIntake(U);
N.SetWaterIntake(U);
cout << "\033[32mAge Successfully Updated!\033[0m" << endl;
//Clear terminal and go back to begining of while loop
Sleep(1000);
system("cls");
break;
}
case 5: {
// Update gender
cout << "Enter Your Gender \033[33m(male/female)\033[0m: ";
U.UpdateGender();
/*
Update all the nutrition information because the
user changed the weight which affects the daily
calorie and protein and water intake
*/
N.setPerson(U);
N.SetCalorieIntake(U);
N.SetProteinIntake(U);
N.SetWaterIntake(U);
cout << "\033[32mGender Successfully Updated!\033[0m" << endl;
//Clear terminal and go back to begining of while loop
Sleep(1000);
system("cls");
break;
}
case 0: {
//Clear terminal and go back to main of while loop
system("cls");
break;
}
default:
cout << "\033[31mX Invalid choice X\033[1;0m" << endl
<< "\033[31mPlease Try Again\033[1;0m" << endl;
Sleep(2000);
system("cls");
break;
}
}
break; // Go back to original while loop
}
case 3: {
// nutrition help
int choose = 1;
// loop untill user chooses to go back by entering 0
while (choose != 0) {
system("cls");
// nutrition help menu
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> Nutrition Help\033[1;0m\n" << endl;
cout << "\033[33mChoose one of the following operations:\033[0m\n"
<< "1. Calorie Intake\n"
<< "2. Protein Intake\n"
<< "3. Sleeping Hours\n"
<< "4. Meal Plan\n"
<< "5. New Day\n" //reset all intakes and empty meal plan
<< "0. \033[31mGo Back\033[0m\n\n"
<< "--> ";
cin >> choose; //let user choose based on previous list
switch (choose) {
case 1: {
// display calorie intake
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> Nutrition Help\033[1;0m" << endl;
cout << "\033[34;47m>> Calorie Intake\033[1;0m\n" << endl;
cout << "You should consume " << N.GetCalorieIntake() << " more calories today\n";
Sleep(3000);
system("cls");
break;
}
case 2: {
// display protein intake
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> Nutrition Help\033[1;0m" << endl;
cout << "\033[34;47m>> Protein Intake\033[1;0m\n" << endl;
cout << "You should consume " << N.GetProteinIntake() << " more grams of protein today\n";
Sleep(3000);
system("cls");
break;
}
case 3: {
// sleepiong hours
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> Nutrition Help\033[1;0m" << endl;
cout << "\033[34;47m>> Sleeping Hours\033[1;0m\n" << endl;
int RSH = 9; // RSH = Recommended Sleeping Hours, which is 9
int HS = 0; // HS = Hours Slept
cout << "It is recommended to sleep 9 hours per day.\n"
<< "\033[33mHow many hours did you sleep?\033[0m\n--> ";
cin >> HS; //let user enter how many hours he slept
N.SetHoursSlept(HS);
// if user slept less than RSH
if (N.GetHoursSlept() != RSH && N.GetHoursSlept() < RSH) {
cout << "\033[31m" << U.getName() << "! You don't sleep enough! \n"
<< "You need to sleep " << RSH - N.GetHoursSlept() << " more hours.\033[0m\n";
Sleep(5000);
system("cls");
break;
}
// if user slept more than RSH
else if (N.GetHoursSlept() != RSH && N.GetHoursSlept() > RSH) {
cout << "\033[31m" << U.getName() << "! Don't be lazy! You sleep a lot! \n"
<< "You need to sleep " << N.GetHoursSlept() - RSH << " less hours.\033[0m\n";
Sleep(5000);
system("cls");
break;
}
//if user slept RSH
else if (N.GetHoursSlept() == RSH) {
cout << "\033[32mGood Job " << U.getName() << "! Your sleep schedule is perfect, keep it up!\033[0m\n";
Sleep(5000);
system("cls");
break;
}
break;
}
case 4: {
// meal plan options
int choose2 = 1;
while (choose2 != 0) {
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> Nutrition Help\033[1;0m" << endl;
cout << "\033[34;47m>> Meal Plan\033[1;0m\n" << endl;
cout << "\033[33mChoose one of the following operations:\033[0m\n"
<< "1. Show all available meals in the system\n"
<< "2. Add Meal to system\n"
<< "3. Create Meal Plan\n"
<< "4. Show Meal plan for the day\n"
<< "5. Enter what you ate today\n"
<< "0. \033[31mGo Back\033[0m\n\n"
<< "--> ";
cin >> choose2;
switch (choose2) {
case 1: {
// Show all available meals in the system
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> Nutrition Help\033[1;0m" << endl;
cout << "\033[34;47m>> Meal Plan\033[1;0m" << endl;
cout << "\033[34;47m>>> Available Meals\033[1;0m\n" << endl;
N.printMap();
cout << "\033[33mPress 0 to go back: \033[0m";
int al = 1;
while (al != 0) {
cin >> al;
if (al == 0) {
break;
}
}
break;
}
case 2: {
// Add meal to system
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> Nutrition Help\033[1;0m" << endl;
cout << "\033[34;47m>> Meal Plan\033[1;0m" << endl;
cout << "\033[34;47m>>> Add Meal\033[1;0m\n" << endl;
string nm;
int cal, prt;
cout << "-Enter Name of the Meal: ";
cin >> nm;
cout << "\n-Enter Amount of calories per 100g: ";
cin >> cal;
cout << "\n-Enter Amount of Protein per 100g: ";
cin >> prt;
N.addMeals(nm, cal, prt);
cout << "Added" << endl;
break;
}
case 3: {
// Create Meal Plan
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> Nutrition Help\033[1;0m" << endl;
cout << "\033[34;47m>> Meal Plan\033[1;0m" << endl;
cout << "\033[34;47m>>> Create Meal Plan\033[1;0m\n" << endl;
int choose3 = 1;
while (choose3 != 0) {
cout << "\033[31mRemember to enter the meals in order of what you will eat first then last\033[0m\n";
string nm;
cout << "-Choose from the following: \n";
N.printMap();
cout << "-\033[33mEnter the exact Name of the food you want to add to the meal plan: \033[0m";
cin >> nm;
N.AddToMealPlan(nm);
cout << "-Press 0 to go back, or 1 to add another meal: ";
cin >> choose3;
}
break;
}
case 4: {
// Show Meal plan for the day
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> Nutrition Help\033[1;0m" << endl;
cout << "\033[34;47m>> Meal Plan\033[1;0m" << endl;
cout << "\033[34;47m>>> Meal Plan For The Day\033[1;0m\n" << endl;
int al = 1;
N.printMealPlan();
// goes back if input is 0
while (al != 0) {
cout << "-Enter 0 to go back: ";
cin >> al;
system("cls");
}
break;
}
case 5: {
// Enter what you ate today
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> Nutrition Help\033[1;0m" << endl;
cout << "\033[34;47m>> Meal Plan\033[1;0m" << endl;
cout << "\033[34;47m>>> What You ate Today\033[1;0m\n" << endl;
int choose3 = 1;
while (choose3 != 0) {
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> Nutrition Help\033[1;0m" << endl;
cout << "\033[34;47m>> Meal Plan\033[1;0m" << endl;
cout << "\033[34;47m>>> What You ate Today\033[1;0m\n" << endl;
cout << "1. From Meal Plan\n"
<< "2. Not From Meal Plan\n"
<< "0. \033[31mGo Back\033[0m\n\n"
<< "--> ";
cin >> choose3;
switch (choose3) {
case 1: {
// From Meal Plan
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> Nutrition Help\033[1;0m" << endl;
cout << "\033[34;47m>> Meal Plan\033[1;0m" << endl;
cout << "\033[34;47m>>> What You ate Today\033[1;0m" << endl;
cout << "\033[34;47m>>>> From Meal Plan\033[1;0m\n" << endl;
N.SetRemainingCnP(N.AccessFrontElement());
N.RemoveFromMealPlan();
cout << "\033[32mUpdating Meal plan and Daily intake\033[0m\n";
Sleep(1000);
system("cls");
break;
}
case 2: {
// Not From Meal Plan
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[0m" << endl;
cout << "\033[34;47m> Nutrition Help\033[0m" << endl;
cout << "\033[34;47m>> Meal Plan\033[0m" << endl;
cout << "\033[34;47m>>> What You ate Today\033[0m" << endl;
cout << "\033[34;47m>>>> Not From Meal Plan\033[0m\n" << endl;
cout << "Available Meals:\n";
N.printMap();
cout << "\n-Enter the name of the food: ";
string nm;
cin >> nm;
N.SetRemainingCnP(nm);
cout << "\033[32mDaily intake updated\n\033[0m";
Sleep(1000);
system("cls");
break;
}
case 0: {
// go back
system("cls");
break;
}
default: {
// invalid input
cout << "\033[31mX Invalid choice X\033[1;0m" << endl
<< "\033[31mPlease Try Again\033[1;0m" << endl;
Sleep(2000);
system("cls");
break;
}
}
}
break;
}
case 0: {
// go back
system("cls");
break;
}
default: {
// invalid input
cout << "\033[31mX Invalid choice X\033[1;0m" << endl
<< "\033[31mPlease Try Again\033[1;0m" << endl;
Sleep(2000);
system("cls");
break;
}
}
}
break;
}
case 5: {
// new day
cout << "\33[31mWarning! The meal plan will be deleted and set empty!!\n"
<< "Are you sure you want to continue? \33[33m(y/n) \33[0m";
// confirm with user
char yn;
cin >> yn;
if (yn == 'y') {
N.Clear(U);
break;
}
if (yn == 'n') {
system("cls");
break;
}
}
case 0:
// go back
system("cls");
break;
default:
// invalid input
cout << "\033[31mX Invalid choice X\033[1;0m" << endl
<< "\033[31mPlease Try Again\033[1;0m" << endl;
Sleep(2000);
system("cls");
break;
}
}
break;
}
case 4: {
//Anthony Nasry Massaad
// loop for workout options
while (activityChoice != 0) {
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> WORKOUT\033[1;0m\n" << endl;
cout << "\033[33mSelect your activity:\033[1;0m" << endl;
cout << "1. Walking\n2. Running\n3. Swimming\n4. Cycling\n5. Gym Training\n0. \033[31mGo Back\033[0m\n\n--> ";
cin >> activityChoice;
switch (activityChoice) {
case 1: {
// walking
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> WORKOUT\033[1;0m" << endl;
cout << "\033[34;47m>> WALKING\033[1;0m\n" << endl;
cout << "-Enter the duration of the activity in minutes: ";
cin >> duration;
cout << "-Enter your average speed (km/h): ";
cin >> speed;
cout << "\n\033[32m>>> Estimated calories burned: " << W.calculateCalories(U.getWeight(), duration, speed) << " calories.\033[0m" << endl;
W.updateCalorieIntake_NonGym(U, N, duration, speed);
Sleep(3000);
system("cls");
break;
}
case 2: {
// running
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> WORKOUT\033[1;0m" << endl;
cout << "\033[34;47m>> RUNNING\033[1;0m\n" << endl;
cout << "-Enter the duration of the activity in minutes: ";
cin >> duration;
cout << "-Enter your average speed (km/h): ";
cin >> speed;
cout << "\n\033[32m>>> Estimated calories burned: " << W.calculateCalories(U.getWeight(), duration, speed) << " calories.\033[0m" << endl;
W.updateCalorieIntake_NonGym(U, N, duration, speed);
Sleep(3000);
system("cls");
break;
}
case 3:
{
// swimming
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> WORKOUT\033[1;0m" << endl;
cout << "\033[34;47m>> SWIMMING\033[1;0m\n" << endl;
cout << "-Enter the duration of the activity in minutes: ";
cin >> duration;
cout << "-Enter your average speed (km/h): ";
cin >> speed;
cout << "\n\033[32m>>> Estimated calories burned: " << W.calculateCalories(U.getWeight(), duration, speed) << " calories.\033[0m" << endl;
W.updateCalorieIntake_NonGym(U, N, duration, speed);
Sleep(3000);
system("cls");
break;
}
case 4:
{
// cycling
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> WORKOUT\033[1;0m" << endl;
cout << "\033[34;47m>> CYCLING\033[1;0m\n" << endl;
cout << "-Enter the duration of the activity in minutes: ";
cin >> duration;
cout << "-Enter your average speed (km/h): ";
cin >> speed;
cout << "\n\033[32m>>> Estimated calories burned: " << W.calculateCalories(U.getWeight(), duration, speed) << " calories.\033[0m" << endl;
W.updateCalorieIntake_NonGym(U, N, duration, speed);
Sleep(3000);
system("cls");
break;
}
case 5:
// gym training
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> WORKOUT\033[1;0m" << endl;
cout << "\033[34;47m>> GYM TRAINING\033[1;0m" << endl;
cout << "\033[34;47m>>> FITNESS GOAL\033[1;0m\n" << endl;
cout << "\033[33mEnter your fitness goal:\033[1;0m\n";
cout << "1. Strength\n2. Volume\n3. Endurance\n\n--> ";
int fitnessgoalChoice;
cin >> fitnessgoalChoice;
// get fitness goal
switch (fitnessgoalChoice) {
case 1:
fitnessGoal = "strength";
break;
case 2:
fitnessGoal = "volume";
break;
case 3:
fitnessGoal = "endurance";
break;
default:
{
cout << "\033[31mX Invalid choice X\033[1;0m" << endl
<< "\033[31mAutomatically Set to Default \"STRENGTH\"\033[1; 0m" << endl;
fitnessGoal = "strength";
Sleep(2000);
U.WaitAndClear();
break;
}
}
// set goal
W.setUserFitnessGoal(fitnessGoal);
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> WORKOUT\033[1;0m" << endl;
cout << "\033[34;47m>> GYM TRAINING\033[1;0m" << endl;
cout << "\033[34;47m>>> STRENGTH LEVEL\033[1;0m\n" << endl;
cout << "\033[33mEnter your strength level:\033[1;0m\n";
cout << "1. Beginner\n2. Intermediate\n3. Advanced\n\n--> ";
int strengthLevelChoice;
cin >> strengthLevelChoice;
// get strength level
switch (strengthLevelChoice) {
case 1:
strengthLevel = "beginner";
break;
case 2:
strengthLevel = "intermediate";
break;
case 3:
strengthLevel = "advanced";
break;
default:
cout << "\033[31mX Invalid choice X\033[1;0m" << endl
<< "\033[31mAutomatically Set to Default \"BEGINNER\"\033[1; 0m" << endl;
strengthLevel = "beginner";
Sleep(2000);
system("cls");
break;
}
// set level
W.setUserStrengthLevel(strengthLevel);
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m> WORKOUT\033[1;0m" << endl;
cout << "\033[34;47m>> GYM TRAINING\033[1;0m" << endl;
cout << "\033[34;47m>>> MUSCLE GROUP\033[1;0m\n" << endl;
cout << "\033[33mSelect muscle group to train:\033[1;0m" << endl;
cout << "1. Biceps\n2. Triceps\n3. Shoulders\n4. Back\n5. Legs\n6. Abs\n7. Chest\n\n--> ";
cin >> muscleChoice;
// get desired muscle group to train
switch (muscleChoice) {
case 1:
muscleGroup = "biceps";
break;
case 2:
muscleGroup = "triceps";
break;
case 3:
muscleGroup = "shoulders";
break;
case 4:
muscleGroup = "back";
break;
case 5:
muscleGroup = "legs";
break;
case 6:
muscleGroup = "abs";
break;
case 7:
muscleGroup = "chest";
break;
case 0:
system("cls");
break;
default:
cout << "\033[31mX Invalid choice X\033[1;0m" << endl
<< "\033[31mGoing For Biceps\033[1;0m" << endl;
Sleep(2000);
system("cls");
break;
}
system("cls");
// add selected exercise to queue
W.selectAndQueueExercises(fitnessGoal, strengthLevel, muscleGroup);
break;
case 0:
// go back
system("cls");
break;
default:
// invalid input
cout << "\033[31mX Invalid choice X\033[1;0m" << endl
<< "\033[31mPlease Try Again\033[1;0m" << endl;
Sleep(2000);
break;
}
}
break;
}
case 5: {
// workout queue processing
system("cls");
cout << "\033[30;43mFITNESS TRACKER\033[1;0m" << endl;
cout << "\033[34;47m>> WORKOUT EXECUTION\033[1;0m\n" << endl;
// calculate total calories burned to update calorei intake before clearing the queue
double caloriesBurned = W.calculateTotalCaloriesBurned_Gym();
N.SetBurnedCalories(caloriesBurned);
// clearing queue
W.executeWorkoutQueue();
break;
}
case 0: {
// exit program
// exit message
cout << "\n\033[32mTHANK YOU for using Fitness Tracker.\033[0m" << endl
<< "\033[31mExiting...\033[0m" << endl;
Sleep(4000);
system("cls");
break;
}
default: {
// invalid choice
cout << "\033[31mX Invalid choice X\033[1;0m" << endl
<< "\033[31mPlease Try Again\033[1;0m" << endl;
Sleep(2000);
system("cls");
break;
}
}
}
}