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

PB-Distribution of BMI Levels

The document outlines a programming problem related to calculating and classifying Body Mass Index (BMI) levels based on weight and height data. It specifies valid input ranges for weight and height, and describes the output format for displaying the most common BMI levels from multiple test cases. The problem includes an example input and output to illustrate the expected results.

Uploaded by

sheng.c.tan
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)
10 views2 pages

PB-Distribution of BMI Levels

The document outlines a programming problem related to calculating and classifying Body Mass Index (BMI) levels based on weight and height data. It specifies valid input ranges for weight and height, and describes the output format for displaying the most common BMI levels from multiple test cases. The problem includes an example input and output to illustrate the expected results.

Uploaded by

sheng.c.tan
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

Online Midterm: Fundamental Computer Programming- C++ Lab(I), Rung-Bin Lin

Nov.. 20, 2021, International Bachelor Program in Informatics, Yuan Ze University

Problem B: Distribution of BMI Levels

(25%) (This problem related to Lab 2 and Lab 3)

Problem Description
A patient’s BMI value is equal to 𝑊/𝐻 2 where W is patient’s weight in kilogram and H is
patient’s height in meter. If 10 ≤ W ≤ 250 and 0.8 ≤ H ≤ 2.4, a patient’s weight and height
data are valid. The BMI levels are presented in the table below. You will be given a number of
data sets, each of which consists of a person’s weight and height. Find out the BMI levels that
have the largest number of data sets being classified into those levels. You have to skip invalid
data sets.

BMI level BMI range(kg/m2)


Unreasonably small BMI (USL) BMI <10
Highly severely underweight (HSUW) 10  BMI < 12
Severely underweight (SUW) 12  BMI <16
Underweight (UW) 16  BMI < 18.5
Normal (NW) 18.5  BMI  25
Overweight (OW) 25 < BMI  30
Lightly obese (LOB) 30 < BMI  35
Obese (OB) 35 < BMI  45
Severely obese (SOB) 45 < BMI 55
Highly severely obese (HSOB) 55 < BMI 65
Unreasonably large BMI (ULL) BMI > 65

Input Format
The first line contains only an integer specifying the number of test cases. Each test case takes a
number of lines. Each pair of numbers form a data set where weight comes first. The input for
each test case ends if either a zero weight or a zero height is read. A patient’s height is in meter
and a patient’s weight is in Kg.

Output Format
The output for a test case takes a line which shows the names of the BMI levels that have the
largest number of data sets being classified into those levels. The level names should be printed
Online Midterm: Fundamental Computer Programming- C++ Lab(I), Rung-Bin Lin
Nov.. 20, 2021, International Bachelor Program in Informatics, Yuan Ze University

in order of increasing BMI values. Level names are separated by at least one whitespace
character. After the level names, it follows the largest number just mentioned. Each output line
should start with a # and then a space character follows.

Example

Sample Input Sample Output


2 # NW 4
56 1.5
# LOB HSOB ULL 4
27 0.93
44 1.3
56 1.65
60 1.8
200 2.4
160 2.1
23 1.6
34 1.3
54 1.8
10 1.6
56 1.3
77 1.75
00
55.5368 0.973478
83.2244 1.51091
83.6522 0.993669
59.3307 1.03328
91.3289 1.0256
37.7452 0.950107
102.638 1.98155
94.1552 1.06598
51.5749 1.2733
78.4518 1.81462
74.3351 1.39702
67.6222 1.02054
50.6061 1.68546
89.7128 1.02757
54.6973 1.92399
61.3853 1.96832
67.2592 1.88996
86.9155 1.21428
53.1396 1.27134
63.5447 2.00142
36.596 1.03894
72.4781 1.43974
00

You might also like