AILADA COLLEGE
For Assistance with other modules
Call or Whatsapp +27682021794
*********************
COS1511
Assignment 03
2022
*********************
Due date
13 June 2022
COS1511 Assignment 3 2022 100% TRUSTED workings, explanations and solutions.
Whatsapp +27682021794 for assistance
1
, QUESTION 1
#include<iostream>
using namespace std;
void getData (double &getWeight, double &getHeight)
{
cout << "Enter your weight (in kilograms): ";
cin >> getWeight;
cout << "\nEnter your height (in Metres): ";
cin >> getHeight;
}
double calcBMI(double cWeight, double cHeight)
{
double bmi=0.0;
bmi = cWeight / (cHeight * cHeight);
return bmi;
}
void displayFitnessResults(double dBMI)
{
if(dBMI < 18.5)
cout << "Your BMI is "<< dBMI <<" You are underweight!! Eat More!!
\n\n";
else if(dBMI >= 18.5 && dBMI <= 25)
cout << "Your BMI is "<< dBMI <<" You are in optimal shape!! Good
Work! \n\n";
else if(dBMI >= 25 && dBMI <= 30)
cout <<"Youe BMI is "<< dBMI << " You are overweight!! Eat Less!!
\n\n";
else if(dBMI >30) cout <<"Youe BMI is "<< dBMI << " You are Obese!! Seek
medical assistance for dietary purposes!! \n\n";
}
//MAIN _FUNCTION
int main()
{
double weight, height, BMI;
cout << "BMI: Body Mass Index \n";
getData(weight, height);
BMI= calcBMI(weight, height);
displayFitnessResults(BMI);
return 0;
}
2
For Assistance with other modules
Call or Whatsapp +27682021794
*********************
COS1511
Assignment 03
2022
*********************
Due date
13 June 2022
COS1511 Assignment 3 2022 100% TRUSTED workings, explanations and solutions.
Whatsapp +27682021794 for assistance
1
, QUESTION 1
#include<iostream>
using namespace std;
void getData (double &getWeight, double &getHeight)
{
cout << "Enter your weight (in kilograms): ";
cin >> getWeight;
cout << "\nEnter your height (in Metres): ";
cin >> getHeight;
}
double calcBMI(double cWeight, double cHeight)
{
double bmi=0.0;
bmi = cWeight / (cHeight * cHeight);
return bmi;
}
void displayFitnessResults(double dBMI)
{
if(dBMI < 18.5)
cout << "Your BMI is "<< dBMI <<" You are underweight!! Eat More!!
\n\n";
else if(dBMI >= 18.5 && dBMI <= 25)
cout << "Your BMI is "<< dBMI <<" You are in optimal shape!! Good
Work! \n\n";
else if(dBMI >= 25 && dBMI <= 30)
cout <<"Youe BMI is "<< dBMI << " You are overweight!! Eat Less!!
\n\n";
else if(dBMI >30) cout <<"Youe BMI is "<< dBMI << " You are Obese!! Seek
medical assistance for dietary purposes!! \n\n";
}
//MAIN _FUNCTION
int main()
{
double weight, height, BMI;
cout << "BMI: Body Mass Index \n";
getData(weight, height);
BMI= calcBMI(weight, height);
displayFitnessResults(BMI);
return 0;
}
2