0% found this document useful (0 votes)
142 views2 pages

Calcbmi : Bmi Weight Category

The document describes a calcBMI() method that calculates body mass index (BMI) given a person's height in meters and weight in kilograms. It provides an example calculation for "Boris" with a height of 2.00m and weight of 104kg, equal to a BMI of 26. The document also describes weight categories based on BMI ranges and includes pseudocode to determine a person's weight category from their BMI. It then provides sample height and weight data for a group of adults stored in arrays and asks questions about finding names, BMI calculations, and comparisons to average BMI.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
142 views2 pages

Calcbmi : Bmi Weight Category

The document describes a calcBMI() method that calculates body mass index (BMI) given a person's height in meters and weight in kilograms. It provides an example calculation for "Boris" with a height of 2.00m and weight of 104kg, equal to a BMI of 26. The document also describes weight categories based on BMI ranges and includes pseudocode to determine a person's weight category from their BMI. It then provides sample height and weight data for a group of adults stored in arrays and asks questions about finding names, BMI calculations, and comparisons to average BMI.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

The following method, calcBMI() accepts person’s height (H) in metres (m) and weight (W)

in kilograms (kg) and returns their Body Mass Index (BMI).

calcBMI(H, W)
X = H * H
B = W / X
return B
endcalcBMI

Boris weighs 104 kg and is 2.00 m tall. His BMI can be calculated by calling method
calcBMI() as follows

BorisBMI = calcBMI(2.00, 104).

(a) State the value of variable BorisBMI. [1]

A person can belong to one of the following four weight categories:

BMI Weight category

less than 18.5 underweight

from 18.5 but less than 25.0 normal weight

from 25.0 but less than 30.0 overweight

greater than or equal to 30.0 obese

(b) Use pseudocode to construct an algorithm which accepts a person’s BMI and outputs
the weight category the person belongs to. [4]

(This question continues on the following page)


(Question 10 continued)

The data about a group of adults and their height measurement (in metres) and weight
measurement (in kg) is held in three one-dimensional arrays.

NAME WEIGHT HEIGHT


(kg) (m)
[0] Annie [0] 52.40 [0] 1.56
[1] Boris [1] 100.00 [1] 2.00
[2] Hugh [2] 105.00 [2] 2.03
[3] Paul [3] 61.00 [3] 1.75
[4] Robby [4] 88.00 [4] 1.80

… … … … … …

… … … … … …
[29] Zara [29] 68.00 [29] 1.71

Where
NAME is a one-dimensional array holding names (currently sorted in alphabetical order).
WEIGHT is a one-dimensional array holding weight measurement in kilograms.
HEIGHT is a one-dimensional array holding height measurement in metres.

For example,
NAME[0] is Annie.
Her weight measurement is 52.40 kg and can be found in WEIGHT[0].
HEIGHT[0] is 1.56 which represents Annie’s height measurement in metres.

(c) State the name of the person whose height is held in HEIGHT[3]. [1]

(d) (i) Identify one reason why a binary search algorithm cannot be used to find the
name of person whose height is given. [1]

(ii) Describe how the name of person whose height is given could be output. [2]

(e) Construct an algorithm which will output the names of all the people whose BMI is
greater than this group’s average BMI.

You should call method calcBMI() in your answer. [6]

You might also like