SlideShare a Scribd company logo
// HealthProfile.h
#include
using namespace std;
class HealthProfile
{
public:
HealthProfile ( string fname, string lname, char g, int mm, int dd, int yy, float h, float w );
void setFirstName ( string fname);
string getFirstName ();
void setLastName (string lname);
string getLastName ();
void setGender (char g);
char getGender ();
void setMonthOfBirth (int mm);
int getMonthOfBirth ();
void setDayOfBirth (int dd);
int getDayOfBirth ();
void setYearOfBirth(int yy);
int getYearOfBirth();
void setHeight (float h);
float getHeight();
void setWeight(float w);
float getWeight();
int getAge();
int getMaximumHeartRate();
string getTargetHeartRate();
float getBMI();
private:
string firstName;
string lastName;
char gender;
int dayOfBirth;
int monthOfBirth;
int yearOfBirth;
float height;
float weight;
};
// HealthProfile.cpp
#include
#include
#include
#include "HealthProfile.h"
using namespace std;
template
std::string toString(T val)
{
std::ostringstream oss;
oss << val;
return oss.str();
}
HealthProfile::HealthProfile ( string fname, string lname, char g, int mm, int dd, int yy, float h,
float w )
{
setFirstName(fname);
setLastName(lname);
setGender(g);
setMonthOfBirth(mm);
setDayOfBirth(dd);
setYearOfBirth(yy);
setHeight(h);
setWeight(w);
}
void HealthProfile::setFirstName ( string fname)
{
firstName = fname;
}
string HealthProfile::getFirstName ()
{
return firstName;
}
void HealthProfile::setLastName (string lname)
{
lastName = lname;
}
string HealthProfile::getLastName ()
{
return lastName;
}
void HealthProfile::setGender (char g)
{
gender = g;
}
char HealthProfile::getGender()
{
return gender;
}
void HealthProfile::setMonthOfBirth (int mm)
{
monthOfBirth = mm;
}
int HealthProfile::getMonthOfBirth ()
{
return monthOfBirth;
}
void HealthProfile::setDayOfBirth (int dd)
{
dayOfBirth = dd;
}
int HealthProfile::getDayOfBirth ()
{
return dayOfBirth;
}
void HealthProfile::setYearOfBirth(int yy)
{
yearOfBirth = yy;
}
int HealthProfile::getYearOfBirth()
{
return yearOfBirth;
}
void HealthProfile::setHeight (float h)
{
height = h;
}
float HealthProfile::getHeight()
{
return height;
}
void HealthProfile::setWeight(float w)
{
weight = w;
}
float HealthProfile::getWeight()
{
return weight;
}
int HealthProfile::getAge()
{
int delta = 0;
int month, day, year;
cout << "Enter current date: ";
cin >> month >> day >> year;
// decide if birthday this year passed
if (getMonthOfBirth() > month) delta = -1;
if ((getMonthOfBirth() == month) && (getDayOfBirth() > day)) delta = -1;
return (year - getYearOfBirth() + delta);
}
int HealthProfile::getMaximumHeartRate()
{
return (220 - getAge());
}
string HealthProfile::getTargetHeartRate()
{
int max;
max = getMaximumHeartRate();
string lowrate, highrate;
lowrate = toString(max * 50 / 100);
highrate = toString(max * 85 / 100);
return (lowrate + "-" + highrate);
}
float HealthProfile::getBMI()
{
return (weight / (height * height));
}
// main.cpp
#include
#include
#include "HealthProfile.h"
using namespace std;
int main()
{
string fname, lname;
char g;
int mm, dd, yy;
float h, w;
cout << "Enter your first name, last name, gender and date of birth (first name, last name,
month, day, year): ";
cin >> fname >> lname >> g >> mm >> dd >> yy;
cout << "Enter your height (in meters) and weight (in kilograms): ";
cin >> h >> w;
HealthProfile personProfile (fname, lname, g, mm, dd, yy, h, w);
cout << "Your name is " << personProfile.getFirstName() << " " <<
personProfile.getLastName() << ". Your birthday is " << personProfile.getMonthOfBirth() <<
"/" << personProfile.getDayOfBirth() << "/" << personProfile.getYearOfBirth() << endl;
cout << "Your age is " << personProfile.getAge() << " years!" << endl;
cout << "Your maximum heart rate is " << personProfile.getMaximumHeartRate() << endl;
cout << "Your target heart rate is " << personProfile.getTargetHeartRate() << endl;
cout << "Your BMI is " << personProfile.getBMI() << endl;
cout << endl;
cout << "BMI VALUES ";
cout << "Underweight: less than 18.5 ";
cout << "Normal: between 18.5 and 24.9 ";
cout << "Overweight: between 25 and 29.9 ";
cout << "Obese: 30 or greater ";
return 0;
}
/*
output:
Enter your first name, last name, gender and date of birth (first name, last name, month, day,
year): Jason Roy M 12 31 1992
Enter your height (in meters) and weight (in kilograms): 2.1 71
Your name is Jason Roy. Your birthday is 12/31/1992
Enter current date: 9 22 2016
Your age is 23 years!
Enter current date: 9 12 2016
Your maximum heart rate is 197
Enter current date: 9 12 2016
Your target heart rate is 98-167
Your BMI is 16.0998
BMI VALUES
Underweight: less than 18.5
Normal: between 18.5 and 24.9
Overweight: between 25 and 29.9
Obese: 30 or greater
*/
Solution
// HealthProfile.h
#include
using namespace std;
class HealthProfile
{
public:
HealthProfile ( string fname, string lname, char g, int mm, int dd, int yy, float h, float w );
void setFirstName ( string fname);
string getFirstName ();
void setLastName (string lname);
string getLastName ();
void setGender (char g);
char getGender ();
void setMonthOfBirth (int mm);
int getMonthOfBirth ();
void setDayOfBirth (int dd);
int getDayOfBirth ();
void setYearOfBirth(int yy);
int getYearOfBirth();
void setHeight (float h);
float getHeight();
void setWeight(float w);
float getWeight();
int getAge();
int getMaximumHeartRate();
string getTargetHeartRate();
float getBMI();
private:
string firstName;
string lastName;
char gender;
int dayOfBirth;
int monthOfBirth;
int yearOfBirth;
float height;
float weight;
};
// HealthProfile.cpp
#include
#include
#include
#include "HealthProfile.h"
using namespace std;
template
std::string toString(T val)
{
std::ostringstream oss;
oss << val;
return oss.str();
}
HealthProfile::HealthProfile ( string fname, string lname, char g, int mm, int dd, int yy, float h,
float w )
{
setFirstName(fname);
setLastName(lname);
setGender(g);
setMonthOfBirth(mm);
setDayOfBirth(dd);
setYearOfBirth(yy);
setHeight(h);
setWeight(w);
}
void HealthProfile::setFirstName ( string fname)
{
firstName = fname;
}
string HealthProfile::getFirstName ()
{
return firstName;
}
void HealthProfile::setLastName (string lname)
{
lastName = lname;
}
string HealthProfile::getLastName ()
{
return lastName;
}
void HealthProfile::setGender (char g)
{
gender = g;
}
char HealthProfile::getGender()
{
return gender;
}
void HealthProfile::setMonthOfBirth (int mm)
{
monthOfBirth = mm;
}
int HealthProfile::getMonthOfBirth ()
{
return monthOfBirth;
}
void HealthProfile::setDayOfBirth (int dd)
{
dayOfBirth = dd;
}
int HealthProfile::getDayOfBirth ()
{
return dayOfBirth;
}
void HealthProfile::setYearOfBirth(int yy)
{
yearOfBirth = yy;
}
int HealthProfile::getYearOfBirth()
{
return yearOfBirth;
}
void HealthProfile::setHeight (float h)
{
height = h;
}
float HealthProfile::getHeight()
{
return height;
}
void HealthProfile::setWeight(float w)
{
weight = w;
}
float HealthProfile::getWeight()
{
return weight;
}
int HealthProfile::getAge()
{
int delta = 0;
int month, day, year;
cout << "Enter current date: ";
cin >> month >> day >> year;
// decide if birthday this year passed
if (getMonthOfBirth() > month) delta = -1;
if ((getMonthOfBirth() == month) && (getDayOfBirth() > day)) delta = -1;
return (year - getYearOfBirth() + delta);
}
int HealthProfile::getMaximumHeartRate()
{
return (220 - getAge());
}
string HealthProfile::getTargetHeartRate()
{
int max;
max = getMaximumHeartRate();
string lowrate, highrate;
lowrate = toString(max * 50 / 100);
highrate = toString(max * 85 / 100);
return (lowrate + "-" + highrate);
}
float HealthProfile::getBMI()
{
return (weight / (height * height));
}
// main.cpp
#include
#include
#include "HealthProfile.h"
using namespace std;
int main()
{
string fname, lname;
char g;
int mm, dd, yy;
float h, w;
cout << "Enter your first name, last name, gender and date of birth (first name, last name,
month, day, year): ";
cin >> fname >> lname >> g >> mm >> dd >> yy;
cout << "Enter your height (in meters) and weight (in kilograms): ";
cin >> h >> w;
HealthProfile personProfile (fname, lname, g, mm, dd, yy, h, w);
cout << "Your name is " << personProfile.getFirstName() << " " <<
personProfile.getLastName() << ". Your birthday is " << personProfile.getMonthOfBirth() <<
"/" << personProfile.getDayOfBirth() << "/" << personProfile.getYearOfBirth() << endl;
cout << "Your age is " << personProfile.getAge() << " years!" << endl;
cout << "Your maximum heart rate is " << personProfile.getMaximumHeartRate() << endl;
cout << "Your target heart rate is " << personProfile.getTargetHeartRate() << endl;
cout << "Your BMI is " << personProfile.getBMI() << endl;
cout << endl;
cout << "BMI VALUES ";
cout << "Underweight: less than 18.5 ";
cout << "Normal: between 18.5 and 24.9 ";
cout << "Overweight: between 25 and 29.9 ";
cout << "Obese: 30 or greater ";
return 0;
}
/*
output:
Enter your first name, last name, gender and date of birth (first name, last name, month, day,
year): Jason Roy M 12 31 1992
Enter your height (in meters) and weight (in kilograms): 2.1 71
Your name is Jason Roy. Your birthday is 12/31/1992
Enter current date: 9 22 2016
Your age is 23 years!
Enter current date: 9 12 2016
Your maximum heart rate is 197
Enter current date: 9 12 2016
Your target heart rate is 98-167
Your BMI is 16.0998
BMI VALUES
Underweight: less than 18.5
Normal: between 18.5 and 24.9
Overweight: between 25 and 29.9
Obese: 30 or greater
*/

More Related Content

Recently uploaded

ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
JomonJoseph58
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 

Recently uploaded (20)

ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 

Featured

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
 

Featured (20)

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

HealthProfile.h #include stringusing namespace std;class .pdf

  • 1. // HealthProfile.h #include using namespace std; class HealthProfile { public: HealthProfile ( string fname, string lname, char g, int mm, int dd, int yy, float h, float w ); void setFirstName ( string fname); string getFirstName (); void setLastName (string lname); string getLastName (); void setGender (char g); char getGender (); void setMonthOfBirth (int mm); int getMonthOfBirth (); void setDayOfBirth (int dd); int getDayOfBirth (); void setYearOfBirth(int yy); int getYearOfBirth(); void setHeight (float h); float getHeight(); void setWeight(float w); float getWeight(); int getAge(); int getMaximumHeartRate(); string getTargetHeartRate(); float getBMI(); private: string firstName; string lastName; char gender; int dayOfBirth; int monthOfBirth; int yearOfBirth; float height;
  • 2. float weight; }; // HealthProfile.cpp #include #include #include #include "HealthProfile.h" using namespace std; template std::string toString(T val) { std::ostringstream oss; oss << val; return oss.str(); } HealthProfile::HealthProfile ( string fname, string lname, char g, int mm, int dd, int yy, float h, float w ) { setFirstName(fname); setLastName(lname); setGender(g); setMonthOfBirth(mm); setDayOfBirth(dd); setYearOfBirth(yy); setHeight(h); setWeight(w); } void HealthProfile::setFirstName ( string fname) { firstName = fname; } string HealthProfile::getFirstName () { return firstName; }
  • 3. void HealthProfile::setLastName (string lname) { lastName = lname; } string HealthProfile::getLastName () { return lastName; } void HealthProfile::setGender (char g) { gender = g; } char HealthProfile::getGender() { return gender; } void HealthProfile::setMonthOfBirth (int mm) { monthOfBirth = mm; } int HealthProfile::getMonthOfBirth () { return monthOfBirth; } void HealthProfile::setDayOfBirth (int dd) { dayOfBirth = dd; } int HealthProfile::getDayOfBirth () { return dayOfBirth; } void HealthProfile::setYearOfBirth(int yy) { yearOfBirth = yy; }
  • 4. int HealthProfile::getYearOfBirth() { return yearOfBirth; } void HealthProfile::setHeight (float h) { height = h; } float HealthProfile::getHeight() { return height; } void HealthProfile::setWeight(float w) { weight = w; } float HealthProfile::getWeight() { return weight; } int HealthProfile::getAge() { int delta = 0; int month, day, year; cout << "Enter current date: "; cin >> month >> day >> year; // decide if birthday this year passed if (getMonthOfBirth() > month) delta = -1; if ((getMonthOfBirth() == month) && (getDayOfBirth() > day)) delta = -1; return (year - getYearOfBirth() + delta); } int HealthProfile::getMaximumHeartRate() { return (220 - getAge()); } string HealthProfile::getTargetHeartRate()
  • 5. { int max; max = getMaximumHeartRate(); string lowrate, highrate; lowrate = toString(max * 50 / 100); highrate = toString(max * 85 / 100); return (lowrate + "-" + highrate); } float HealthProfile::getBMI() { return (weight / (height * height)); } // main.cpp #include #include #include "HealthProfile.h" using namespace std; int main() { string fname, lname; char g; int mm, dd, yy; float h, w; cout << "Enter your first name, last name, gender and date of birth (first name, last name, month, day, year): "; cin >> fname >> lname >> g >> mm >> dd >> yy; cout << "Enter your height (in meters) and weight (in kilograms): "; cin >> h >> w; HealthProfile personProfile (fname, lname, g, mm, dd, yy, h, w); cout << "Your name is " << personProfile.getFirstName() << " " << personProfile.getLastName() << ". Your birthday is " << personProfile.getMonthOfBirth() << "/" << personProfile.getDayOfBirth() << "/" << personProfile.getYearOfBirth() << endl; cout << "Your age is " << personProfile.getAge() << " years!" << endl; cout << "Your maximum heart rate is " << personProfile.getMaximumHeartRate() << endl; cout << "Your target heart rate is " << personProfile.getTargetHeartRate() << endl; cout << "Your BMI is " << personProfile.getBMI() << endl;
  • 6. cout << endl; cout << "BMI VALUES "; cout << "Underweight: less than 18.5 "; cout << "Normal: between 18.5 and 24.9 "; cout << "Overweight: between 25 and 29.9 "; cout << "Obese: 30 or greater "; return 0; } /* output: Enter your first name, last name, gender and date of birth (first name, last name, month, day, year): Jason Roy M 12 31 1992 Enter your height (in meters) and weight (in kilograms): 2.1 71 Your name is Jason Roy. Your birthday is 12/31/1992 Enter current date: 9 22 2016 Your age is 23 years! Enter current date: 9 12 2016 Your maximum heart rate is 197 Enter current date: 9 12 2016 Your target heart rate is 98-167 Your BMI is 16.0998 BMI VALUES Underweight: less than 18.5 Normal: between 18.5 and 24.9 Overweight: between 25 and 29.9 Obese: 30 or greater */ Solution // HealthProfile.h #include using namespace std; class HealthProfile {
  • 7. public: HealthProfile ( string fname, string lname, char g, int mm, int dd, int yy, float h, float w ); void setFirstName ( string fname); string getFirstName (); void setLastName (string lname); string getLastName (); void setGender (char g); char getGender (); void setMonthOfBirth (int mm); int getMonthOfBirth (); void setDayOfBirth (int dd); int getDayOfBirth (); void setYearOfBirth(int yy); int getYearOfBirth(); void setHeight (float h); float getHeight(); void setWeight(float w); float getWeight(); int getAge(); int getMaximumHeartRate(); string getTargetHeartRate(); float getBMI(); private: string firstName; string lastName; char gender; int dayOfBirth; int monthOfBirth; int yearOfBirth; float height; float weight; }; // HealthProfile.cpp #include #include #include
  • 8. #include "HealthProfile.h" using namespace std; template std::string toString(T val) { std::ostringstream oss; oss << val; return oss.str(); } HealthProfile::HealthProfile ( string fname, string lname, char g, int mm, int dd, int yy, float h, float w ) { setFirstName(fname); setLastName(lname); setGender(g); setMonthOfBirth(mm); setDayOfBirth(dd); setYearOfBirth(yy); setHeight(h); setWeight(w); } void HealthProfile::setFirstName ( string fname) { firstName = fname; } string HealthProfile::getFirstName () { return firstName; } void HealthProfile::setLastName (string lname) { lastName = lname; } string HealthProfile::getLastName () {
  • 9. return lastName; } void HealthProfile::setGender (char g) { gender = g; } char HealthProfile::getGender() { return gender; } void HealthProfile::setMonthOfBirth (int mm) { monthOfBirth = mm; } int HealthProfile::getMonthOfBirth () { return monthOfBirth; } void HealthProfile::setDayOfBirth (int dd) { dayOfBirth = dd; } int HealthProfile::getDayOfBirth () { return dayOfBirth; } void HealthProfile::setYearOfBirth(int yy) { yearOfBirth = yy; } int HealthProfile::getYearOfBirth() { return yearOfBirth; } void HealthProfile::setHeight (float h) {
  • 10. height = h; } float HealthProfile::getHeight() { return height; } void HealthProfile::setWeight(float w) { weight = w; } float HealthProfile::getWeight() { return weight; } int HealthProfile::getAge() { int delta = 0; int month, day, year; cout << "Enter current date: "; cin >> month >> day >> year; // decide if birthday this year passed if (getMonthOfBirth() > month) delta = -1; if ((getMonthOfBirth() == month) && (getDayOfBirth() > day)) delta = -1; return (year - getYearOfBirth() + delta); } int HealthProfile::getMaximumHeartRate() { return (220 - getAge()); } string HealthProfile::getTargetHeartRate() { int max; max = getMaximumHeartRate(); string lowrate, highrate; lowrate = toString(max * 50 / 100); highrate = toString(max * 85 / 100);
  • 11. return (lowrate + "-" + highrate); } float HealthProfile::getBMI() { return (weight / (height * height)); } // main.cpp #include #include #include "HealthProfile.h" using namespace std; int main() { string fname, lname; char g; int mm, dd, yy; float h, w; cout << "Enter your first name, last name, gender and date of birth (first name, last name, month, day, year): "; cin >> fname >> lname >> g >> mm >> dd >> yy; cout << "Enter your height (in meters) and weight (in kilograms): "; cin >> h >> w; HealthProfile personProfile (fname, lname, g, mm, dd, yy, h, w); cout << "Your name is " << personProfile.getFirstName() << " " << personProfile.getLastName() << ". Your birthday is " << personProfile.getMonthOfBirth() << "/" << personProfile.getDayOfBirth() << "/" << personProfile.getYearOfBirth() << endl; cout << "Your age is " << personProfile.getAge() << " years!" << endl; cout << "Your maximum heart rate is " << personProfile.getMaximumHeartRate() << endl; cout << "Your target heart rate is " << personProfile.getTargetHeartRate() << endl; cout << "Your BMI is " << personProfile.getBMI() << endl; cout << endl; cout << "BMI VALUES "; cout << "Underweight: less than 18.5 "; cout << "Normal: between 18.5 and 24.9 "; cout << "Overweight: between 25 and 29.9 "; cout << "Obese: 30 or greater ";
  • 12. return 0; } /* output: Enter your first name, last name, gender and date of birth (first name, last name, month, day, year): Jason Roy M 12 31 1992 Enter your height (in meters) and weight (in kilograms): 2.1 71 Your name is Jason Roy. Your birthday is 12/31/1992 Enter current date: 9 22 2016 Your age is 23 years! Enter current date: 9 12 2016 Your maximum heart rate is 197 Enter current date: 9 12 2016 Your target heart rate is 98-167 Your BMI is 16.0998 BMI VALUES Underweight: less than 18.5 Normal: between 18.5 and 24.9 Overweight: between 25 and 29.9 Obese: 30 or greater */