100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS1511 Assignment 3 2022 Solutions $3.41   Add to cart

Other

COS1511 Assignment 3 2022 Solutions

 21 views  0 purchase
  • Course
  • Institution

*****Here you will find all the solutions for COS1511 Assignment 3. Semester 1&2.

Preview 2 out of 13  pages

  • July 1, 2022
  • 13
  • 2021/2022
  • Other
  • Unknown
avatar-seller
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);

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller segodithabang. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $3.41. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

72042 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$3.41
  • (0)
  Add to cart