#include #include float GetAns(char *, float, float); char GetAn(char *, char, char, char, char); float Age, TimeIn, TimeOut, DaysInAWeek, TimeOnShift, Rotate, Alert, Accidents, HoursOfExercise, Sleep, Snack, FruitsVegetables, SugarFat, Grains, Fluids, DifficultySleeping; char Gender, Sodium, Sugar, AlertAftSnack, Medicalillnesses, Gastrointestinal, Cardiovascular, SleepingDisorders, Otherillnesses; void AskQuestions (void) { Gender=GetAn("What is the shiftworker's gender:\n",'M','m','F','f'); Age=GetAns("How old is the shiftworker?", 10, 99); TimeOnShift=GetAns("How many weeks has the shiftworker been on his/her current shift?", 0, 9999); cout<<"Answer the following two questions using a twenty-four hour clock,where 0=12 midnight and 23=11 PM. \n"; TimeIn=GetAns("What time does the shiftworker clock in?", 0, 23); TimeOut=GetAns("What time does the shiftworker clock out?", 0, 23); DaysInAWeek=GetAns("How many days does the shiftworker work in a week?", 0, 7); Rotate=GetAns("How often, in weeks, is their shift *usually* rotate?", 0, 999); Alert=GetAns("How many hours after the shiftworker has started his/her shift does he/she feel the least alert?", 0, 24); Accidents=GetAns("How many accidents has the shiftworker been involved in?", 0, 9999); Sleep=GetAns("How many hours of sleep does shift worker have in a day?", 0, 24); DifficultySleeping=GetAn("Does the shiftworker ever have difficulty sleeping?", 'Y', 'y', 'N', 'n'); HoursOfExercise=GetAns("How many hours of exercise does the shiftworker get in a week?", 0, 168); Snack=GetAns("How many snacks does the shiftworker have during his/her shift?", 0, 999); cout<< "In a scale of 0-8, what is the shiftworker's daily intake of: (0 being no intake and 8 being maximum intake)\n"; FruitsVegetables=GetAns("Vegetables and Fruits:", 0, 8); SugarFat=GetAns("Sugars and Fats:", 0, 8); Grains=GetAns("Grains:", 0, 8); Fluids=GetAns("Fluids:", 0,8); Sodium=GetAn("Is the shiftworker's snack sodium based?", 'Y', 'y', 'N', 'n'); Sugar=GetAn("Is the shiftworker's snack sugar based?", 'Y', 'y', 'N','n'); AlertAftSnack=GetAn("Does the shiftworker feel [M]ore or [L]ess alert after his/her snack?", 'M', 'm', 'L', 'l'); Medicalillnesses=GetAn("Does the shiftworker suffer from any medical illnesses?", 'Y', 'y', 'N', 'n'); if (Medicalillnesses == 'Y' || Medicalillnesses == 'y') { Gastrointestinal=GetAn("Does the shiftworker suffer from gastrointestinal problems? (ex. heartburn, indigeston, diaherra, etc.)", 'Y', 'y', 'N', 'n'); Cardiovascular=GetAn("Does the shiftworker suffer from cardiovascular disorders? (ex. heart problems, asthma, etc.)", 'Y', 'y', 'N', 'n'); SleepingDisorders=GetAn("Does the shiftworker suffer from any sleeping disorders? (ex. sleep apnea, insomnia, etc.)", 'Y', 'y', 'N', 'n'); } } void ShowResults(void) { float Alertness, Energy, Health, Adjust; Alertness= (Sleep - abs(TimeOut - TimeIn)); Energy = 14; if (Gastrointestinal == 'Y' || Gastrointestinal == 'y') Energy = Energy - 4; if (Cardiovascular == 'Y' || Cardiovascular == 'y') Energy = Energy - 4; if (SleepingDisorders == 'Y' || SleepingDisorders == 'y') Energy = Energy - 4; if (Age >= 18 && Age <= 25) Health = 20; if (Age >= 26 && Age <= 35) Health = 15; if (Age >= 36 && Age <= 45) Health = 10; if (Age >= 46) Health = 5; if (Rotate == 1 || Rotate == 2) Adjust = 40; if (Rotate == 3 || Rotate == 4) Adjust = 30; if (Rotate == 5 || Rotate == 6) Adjust = 20; if (Rotate > 6) Adjust = 10; cout << "The shiftworker's results are the following: "; cout << "The shiftworker's alertness is (affected by hours of sleep and work): " << Alertness << endl; cout << "The shiftworker's energy (during shift): " << Energy << endl; cout << "The shiftworker's health: " << Health << endl; cout << "The shiftworker's adjustment level: " << Adjust << endl; cout << "The shiftworker's efficiency: " << Alertness + Energy + Health + Adjust << endl; }