Starting from:

$10

Measurement Solved

The objective of this problem is to introduce a simple Object-Oriented Programming (OOP) problem and ensure that students understand the concept of OOP. In this case, it’s tested with the understanding of object.
Problem Description
Given a group of people with different heights and weights, determine the shortest and tallest people in the group, and calculate their body mass index (BMI).
The formula for BMI is
BMI =
Input
The first line of the input contains an integer N (2 <= N <= 100) denoting the number of people in the group. The next N lines contain the information (name, height in centimeters, and weight in kilograms) of the people in the group.
Output
Output the name of the shortest and tallest people in the group, assuming that there is only one shortest person and one tallest person in the group.
Suppose A is the shortest and B is the tallest person in the group, the output will be:
A is the shortest with BMI equals to C.
B is the tallest with BMI equals to D.
Output the BMI value correct to 2 decimal places.
Please refer to sample output for more details.
Sample Input
4
Diamond 178 55
Jarod 160 80
Douglas 180 60
Rod 151 48
Sample Output
Rod is the shortest with BMI equals to 21.05.
Douglas is the tallest with BMI equals to 18.52.
Explanation
BMI for Rod =
BMI for Douglas = 2
Algorithm Template
1. How are you going to store a tuple of (name, height and weight)?
2. How to compare which one is the smallest or tallest?
3. How to output the answer in 2 decimal places?

More products