100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Other

COS1511 Assignment 3 2022 Solutions

Rating
-
Sold
-
Pages
13
Uploaded on
01-07-2022
Written in
2021/2022

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

Institution
Course









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Course

Document information

Uploaded on
July 1, 2022
Number of pages
13
Written in
2021/2022
Type
Other
Person
Unknown

Subjects

Content preview

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);
$3.65
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
segodithabang

Get to know the seller

Seller avatar
segodithabang University Of South Africa
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
4 year
Number of followers
1
Documents
5
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions