COS1511 ASSIGNMENT 03
UNIQUE NUMBER: 830235
Question 1.
#include <iostream>
#include <iomanip>
using namespace std;
void getData(float& weight, float& height);
float calcBMI(float weight, float height);
void displayFitnessResults(float bmi);
int main()
{
float height, weight, bmi;
getData(weight, height);
bmi = calcBMI(weight, height);
displayFitnessResults(bmi);
return 0;
}
void getData(float& weight, float& height)
{
cout << "Enter your weight and height respectively (followed by enter for each variable)" << endl;
cin >> weight;
cin >> height;
}
float calcBMI(float weight, float height)
{
return weight/(height*height);
}
void displayFitnessResults(float bmi)
{
if (bmi < 18.5)
cout << "Your BMI is " << bmi << " and your weight status is Underweight" << endl;
, else if (bmi >= 18.5 && bmi <= 24.9)
cout << "Your BMI is " << bmi << " and your weight status is Healthy" << endl;
else if (bmi >= 25.0 && bmi <= 29.9)
cout << "Your BMI is " << bmi << " and your weight status is Overweight" << endl;
else if (bmi >= 30)
cout << "Your BMI is " << bmi << " and your weight status is Obese" << endl;
}
Question 2.
#include <iostream>
#include <iomanip>
using namespace std;
void studentDetails(string& name, string& surname, string& schoolName);
void getMarks(float& mark1, float& mark2, float& mark3, float& mark4, float& mark5, float&
mark6);
float calcAverageYearMark(float mark1, float mark2, float mark3, float mark4, float mark5, float
mark6);
void minMax(float mark1, float mark2, float mark3, float mark4, float mark5, float mark6);
bool passOrFail(float mark1, float mark2, float mark3, float mark4, float mark5, float mark6);
void awardDistinction(float mark1, float mark2, float mark3, float mark4, float mark5, float mark6);
void codeSymbol(float mark1, float mark2, float mark3, float mark4, float mark5, float mark6);
void displayReport(string name, string surname, string schoolName, float mark1, float mark2, float
mark3, float mark4, float mark5, float mark6);
int main()
{
string name, surname, schoolName;
float mark1, mark2, mark3, mark4, mark5, mark6;
studentDetails(name, surname, schoolName);
UNIQUE NUMBER: 830235
Question 1.
#include <iostream>
#include <iomanip>
using namespace std;
void getData(float& weight, float& height);
float calcBMI(float weight, float height);
void displayFitnessResults(float bmi);
int main()
{
float height, weight, bmi;
getData(weight, height);
bmi = calcBMI(weight, height);
displayFitnessResults(bmi);
return 0;
}
void getData(float& weight, float& height)
{
cout << "Enter your weight and height respectively (followed by enter for each variable)" << endl;
cin >> weight;
cin >> height;
}
float calcBMI(float weight, float height)
{
return weight/(height*height);
}
void displayFitnessResults(float bmi)
{
if (bmi < 18.5)
cout << "Your BMI is " << bmi << " and your weight status is Underweight" << endl;
, else if (bmi >= 18.5 && bmi <= 24.9)
cout << "Your BMI is " << bmi << " and your weight status is Healthy" << endl;
else if (bmi >= 25.0 && bmi <= 29.9)
cout << "Your BMI is " << bmi << " and your weight status is Overweight" << endl;
else if (bmi >= 30)
cout << "Your BMI is " << bmi << " and your weight status is Obese" << endl;
}
Question 2.
#include <iostream>
#include <iomanip>
using namespace std;
void studentDetails(string& name, string& surname, string& schoolName);
void getMarks(float& mark1, float& mark2, float& mark3, float& mark4, float& mark5, float&
mark6);
float calcAverageYearMark(float mark1, float mark2, float mark3, float mark4, float mark5, float
mark6);
void minMax(float mark1, float mark2, float mark3, float mark4, float mark5, float mark6);
bool passOrFail(float mark1, float mark2, float mark3, float mark4, float mark5, float mark6);
void awardDistinction(float mark1, float mark2, float mark3, float mark4, float mark5, float mark6);
void codeSymbol(float mark1, float mark2, float mark3, float mark4, float mark5, float mark6);
void displayReport(string name, string surname, string schoolName, float mark1, float mark2, float
mark3, float mark4, float mark5, float mark6);
int main()
{
string name, surname, schoolName;
float mark1, mark2, mark3, mark4, mark5, mark6;
studentDetails(name, surname, schoolName);