LNK1120 and LNK 2019 errors BMI program

I keep getting LNK2019 and LNK1120 errors...not sure whats going on.

heres the assignment...
Your Task:
Write a class called “client”.

Your client class will have the following private data members:

• 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

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 these parameters will be passed from main upon the creation of the client object, and your constructor will use those values to initialize the appropriate private data members.

 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.

Body mass index (BMI) formula:
BMI = (weight / (height * height))*703

Where weight is the client’s weight in pounds, and height is the client’s height in inches.

 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 clients)
--For a female: 18 calories per pound of body weight
--For a male: 21 calories per pound of body weight

 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.

BMI Status
Below 18.5 Below optimal range
18.5 – 24.9 Optimal range
25.0 and up Exceeds optimal range

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 5 argument constructor. Once the object has been created, you can invoke the member functions to calculate the BMI, calculate the calorie requirements, and lastly, print the client’s information.


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

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;



class Client
{

private:
	string Fname;
	string Lname;
	float height;
	int weight;
	float bmi;
	int calories;
	char gender;

public:
	Client(){ }

	Client(string f, string l, float h, int w, char g)
	{
		Fname = f;
		Lname = l;
		height = h;
		weight = w;
		gender = g;

	}
	void ClientInfo(string f, string l, float h, int w, char g)
	{
		Fname = f;
		Lname = l;
		height = h;
		weight = w;
		gender = g;

	}

	void BMI()
	{
		bmi = (weight / (height * height)) * 703;
	}

	void Calorie()
	{
		if (gender == 'M' || gender == 'm')
			(calories * 21);
		cout << "Male" << endl;

		if (gender == 'F' || gender == 'f')
			(calories * 18);
			cout << "Female" << endl;

	}

	void Information()
	{
		cout << "First Name: " << Fname << endl
			<< "Last Name: " << Lname << endl
			<< "Gender: " << gender << endl
			<< "Height: " << height << endl
			<< "Weight: " << weight << endl
			<< "BMI: " << bmi << endl
			<< "Calories: " << calories << endl;

		if (bmi >= 18.5 && bmi < 25) {
			cout << Fname << Lname << " your BMI is " << setprecision(1) << bmi; // outputting to the user their actaul BMI
			cout << endl;
			cout << "Your body mass index falls within the optimal range"; // outputting their category
		}

		else if (bmi < 18.5) {
			cout << Fname << Lname << " your BMI is " << setprecision(1) << bmi;
			cout << endl;
			cout << "You are underweight.";
		}

		else (bmi >= 25); {
			cout << Fname << Lname << " your BMI is " << setprecision(1) << bmi;
			cout << endl;
			cout << "Your body mass index exceeds the optimal range." << endl 
				<< "Please schedule an appointment with the nutritionist" << endl;
		};
	};
		int main()
		{
			Client c1;
			c1.ClientInfo("", "", 0, 0, gender);
			c1.BMI();
			c1.Calorie();
			c1.Information();

			cout << "Enter client's First Name: "; // Asking the user to input their name
			cin >> Fname ; // Users name 
			cout << endl << "Enter client's Last Name: "; // Asking the user to input their name
			cin >> Lname; // Users name 
			cout << endl << "Enter client's Gender (m/f): " << endl;
			cin >> gender;
			cout << endl << "Enter " << Fname << "'s height in inches: " ; // User height in inches
			cin >> height; // Users height
			cout << endl << "Enter " << Fname << "'s weight in pounds: " ; //Users weight in lbs
			cin >> weight; // Users weight

			cout << endl << endl << "Client's Name: " << Fname << Lname << endl;
			cout << "Gender: " << gender << endl;
			cout << "Height in inches" << height << endl;
			cout << "Weight in pounds:" << weight << endl;
			cout << "Calorie Requirmemnt" << calories << endl;
			cout << "Body Mass Index" << bmi << endl;

			
			system("Pause");
			return 0;
		};
	;	};
You seem to have a lot of extra semicolons in your code. You may want to check their placement. And remember main() must be in the global scope, not inside some class or namespace.

Topic archived. No new replies allowed.