Submitted by: Submitted by hardfitz
Views: 10
Words: 377
Pages: 2
Category: Science and Technology
Date Submitted: 08/21/2016 07:54 PM
INDIVIDUAL ASSIGNMENT
STUDENT NAME | AL HAFIZ BIN GULAM |
ID NUMBER | DIT29-11154816 |
FACULTY | INFORMATION TECHNOLOGY |
LECTURER’S NAME | MISS SANIAH BINTI SULAIMAN |
SUBJECT NAME | C++ PROGRAMMING |
DATE OF SUBMISSION | 18TH MARCH 2016 (FRIDAY) |
One way to determine how healthy a person is by measuring the body fat of the person. The formulas to determine the body fat for female and male are as follows.
Body fat formula for women:
A1 = (body weight x 0.732) + 8.987
A2 = [wrist measurement / 3.14] + [waist measurement x 0.157]
A3 = [hip measurement x 0.249] + [forearm measurement x 0.434]
B = A1 + A2 – A3
Body fat = body weight – B
Body fat formula for men:
A1 = (body weight x 1.082) + 94.42
A2 = wrist measurement / 4.15
B = A1 – A2
Body fat = body weight - B
#include <iostream>
using namespace std;
int main()
{
char gender;
float bodyweight, wrist, waist, hip, forearm, B, bodyfat, bodyfatp, A1, A2, A3;
cout << "Input gender (m/f): ";
cin >> gender;
if (gender == 'f')
{
cout << "Enter body weight: ";
cin >> bodyweight;
cout << "Enter wrist measurement: ";
cin >> wrist;
cout << "Enter waist measurement : ";
cin >> waist;
cout << "Enter hip measurement: ";
cin >> hip;
cout << "Enter forearm measurement: ";
cin >> forearm;
A1 = (bodyweight * 0.723) + 8.987;
A2 = (wrist / 3.140) + (waist * 0.157);
A3 = (hip * 0.249) + (forearm * 0.434);
B = A1 + A2 - A3;
}
else if (gender == 'm')
{
cout << "Enter body weight: ";
cin >> bodyweight;
cout << "Enter wrist measurement : ";
cin >> wrist;
A1 = (bodyweight * 1.082) + 94.42;
A2 = wrist / 4.15;
B = A1 - A2;
}
else
{
cout << "input error" << endl;
}...