Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ program I started but get errors. Please reply with code I can copy, paste and run. Help would be greatly appreciated! #include #include using

C++ program I started but get errors. Please reply with code I can copy, paste and run. Help would be greatly appreciated!

image text in transcribed

#include

#include

using namespace std;

// class Client

class Client

{

// Access specifier

private:

// Data Members

string firstname;

string lastname;

float height;

int weight;

float bmi;

int calories;

char gender;

// access specifier of function

public:

// parameterize constructor

Client(string fname,string lname,float height1,int weight1,char gender1)

{

firstname=fname;

lastname=lname;

height=height1;

weight=weight1;

gender=gender1;

}

// function to calculate BMI

void calcBMI()

{

bmi=(float)(weight/(height*height))*703;

cout

}

// function to calculate calories

void calcCalories()

{

// check gemder and calculate according to its

if(gender=='f')

{

// calculate for female

calories=18*weight;

cout

}

else

{

calories=21*weight;

cout

}

}

// print all the data here

void printData()

{

cout

cout

cout

cout

// call the calories function here and print

cout

calcCalories();

cout

// call the bmi function here

cout

calcBMI();

cout

cout

// check the bmi and print message according to bmi value

if(bmi

{

cout

}

else if(bmi>=18.5 && bmi

{

cout

}

else if(bmi>=25.0)

{

cout

cout

}

}

};

// main function

int main()

{

// declaring a variable

string fname;

string lname;

float height;

int weight;

char gender;

// user input first name

cout

cin>>fname;

// user input last name

cout

cin>>lname;

// user input gender

cout

cin>>gender;

// user input for height

cout

cin>>height;

// user input for weight

cout

cin>>weight;

// for new line

cout

// create a object c and call constructor whit passing parameter

Client c(fname,lname,height,weight,gender);

//call the printData function

c.printData();

// for new line

cout

}

image text in transcribed

The Scenario NutriCentet, Inc. is an accredited weight management clinic that helps clients to assess their nutritional needs. Body Mass Index (BMI) is a measure of weight for height and is widely used in assessing weight status in adults. Your program will calculate a client's BMI as well as compute calorie requirements based on gender and current weight. A function that will calculate a client's calorie requirements. This function will accept no arguments and will have a return type of void. Calorie requirements are the number of calories a client needs to ingest daily in order to maintain his/her current weight. Your function will calculate the calorie requirements based on the weight and gender data members and using the criteria below. Criteria for Calorie Requirements (assuming moderate activity level for all Your Task: Write a class call clients -For a female: 18 calories per pound of body weight --For a male: 21 calories per pound of body weight "lient" Your client class will have the following private data members: A function to print the client's information. This function will accept no arguments and will have a return type of void. It will print the client's full name, gender, height, weight, BMI, and calorie requirements. Additionally, this function will print a statement about the client's BMI based on the table below (e.g. "Your BMI falls within the optimal range"). If a client's BMI is below or exceeding optimal range, advise him/her to make an appointment with the nutritionist. A string for the client's first name .A string for the client's last name * . . * A float for the client's height in inches An int for the client's weight in pounds A float for the client's body mass index (BMI) An int for the client's calorie requirements A char for the client's gender BAII Status Below Below 18.5 18.5-24.9 ange rang and xceeds o Your client class will have the following public member functions A constructor that accepts 5 arguments. The 5 arguments represent the client's 1) first name (string).2) last name (string). 3) height (float). 4) weight (int), and 5) gender (char). The values for th the creation of the client object, and your constructor will use those values to initialize the appropriate private data members. In main, first ask the user for the client's 1) first name, 2) last name, 3) gender, 4) height in inches, and 5) weight in pounds. After you have obtained these values, create a client object and pass the values as arguments, thus executing the 5argument constructor. Once the object has been created, you can invoke the member functions to calculate the BMI, and lastly, print parameters will be passed from main u pon the client's information. Sample Output (for female and male clients) utecertge, Inc. is an accredited Weight Management Climse uCenter, Inc is an accrodited Waght Mnagement Clinic. A member function that will calculate the BMI. This function will accept no arguments and will have a return type of void. The function will calculate the BMI using the formula on the next page and based on the height and weight private data members Enter cient first nme:Jane Enter clients list ame: Dce Enter clients gede(: f Enter Jane's height in inches 65 Enter Jane's weight in pounds 125 Enter clien irstnime: Icl Enter cliens lastame:Doe Enter cliensgeder (f): m Enter John's height in inches: 70 Enter Jobn's weight in pounds: 210 Body mass index (BMD) formula BMI = (weight (height * height)2703 lient name: ane Doe Gender. f Height in inchas: 65 Weight in pounds: 125 Calorie Requirement: 2250 Body Nass Index: 20.7983 Your body mass index falls within the optimal range Press any kay to continue Client name: John Doe Gender m Heigkt in inches: T0 Weight in pounds: 210 Calorie Requirement 4410 Body Mass Index: 301286 Where weight is the client's weight in pounds, and height is the client's height in inches Your body mass index exceeds the optimal range Please schecdule an appointment with the utritionist Pros any kay to comtme

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Sarbanes-Oxley Act?

Answered: 1 week ago

Question

6. Write a job specification.

Answered: 1 week ago

Question

draw curved arrows for the mechanism

Answered: 1 week ago

Question

Does it use a maximum of two typefaces or fonts?

Answered: 1 week ago