Hello everybody I am from Commerce Background
doing some IT stuff got some problem by professors..
Can someone solve this problem thanks..


Program Specification:

“The body mass index (BMI), or Quetelet index, is a statistical measure of the weight of a person scaled according to height. The body mass index (BMI), or Quetelet index, is a statistical measure of the weight of a person scaled according to height.” (Wikipedia, 2008)

Your task is to write a small program to assist with calculating the BMI. The BMI is calculated using the following equation:


Where the weight is measured in kg and the height in meters. The BMI is split into the following subdivisions:

Underweight < 18.5
Normal range 18.5 – 25
Overweight 25 – 30
Obese > 30

Your program is going to be used to store the height and weight 5 volunteers (using an array) and then calculate the BMI of each of these volunteers. The program has been broken down into a number of tasks to assist you with your development. You should write your code so that if the number of volunteers changes in the future the changes to the code will be kept to a minimum.

For each of the tasks provided you should provide basic design information such as any data validation, calculations that need to be performed and a first level algorithm.

Task One:
Design and implement a function that takes as its arguments two values representing the height in meters and their weight in kilograms and returns the BMI.
Task Two:
Design and implement a function that fills an array (which has been passed as an argument) capable of storing the height and weight of 10 volunteers. The function should prompt the user for the weight and height of the 10 volunteers and store them in the array.
Task Three:
Design and implement a function that displays the contents of the data in the array (passed as an argument) and calculates the BMI of each of the volunteers. Your data is to be displayed appropriately in a table with the weight and height being displayed to two decimal places and BMI to one decimal place. For example:

Person Weight (kg) Height (m) BMI
1 57.6 1.56 23.7
2 89.0 1.87 25.5
3 45.2 1.32 25.9
4 100.5 1.32 57.7
Etc…

Optional extra: Indicate, in some way, the people who are overweight or obese in some way, such as:
Person Weight (kg) Height (m) BMI
1 57.6 1.56 23.7
2 89.0 1.87 25.5*
3 45.2 1.32 25.9*
4 100.5 1.32 57.7**

* overweight
** obese

Task Four:
Design and implement a function that takes uses the contents of the data in the array (once again passed as an argument) and displays at the following information:
• average weight
• average height
• average BMI

Optional extras: you can include other information in your report such as:
• lowest (or highest) BMI calculated
• the average BMI
• the median BMI
• displays all of the people and their appropriate weight range (ie underweight or obese)
• number of people within each weight range

Task Five:
Once you have each of the above tasks design and implement a menu system that can be used to test your code, such as:

1. Calculate a single BMI
2. Enter data
3. Display data
4. Display reports
5. Exit
Enter selection:

This menu, should be used so that it can be used to test all of the tasks completed above.

Recommended Answers

All 13 Replies

Urgent for you maybe, but not for me. Just what do you want us to do with those requirements ?

BTW: you failed to post the equation that calculates BMI

Urgent for you maybe, but not for me. Just what do you want us to do with those requirements ?

BTW: you failed to post the equation that calculates BMI

thanks for reply friend
it is
BMI = Weight/height*height

Member Avatar for jencas

No, it's

BMI = Weight/(height*height)

Put in some effort and try at least do write a simple program??? :)

Put in some effort and try at least do write a simple program??? :)

well I am trying and I have written first two programs
at least give me some hints about task third and 4th.

and the problem is I have to use all of the following 'i forgot to mention...
include at least one working and appropriate example of :
o a two-dimensional array
o a switch statement
o an if statement
o a while loop
o a do-while loop
o a for loop
o pointers
o using pointers to iterate through the array

how to do tasks 3 and 4 depends on how you implemented the previous tasks. You will be using many (if not all) the features you posted in those functions.

how to do tasks 3 and 4 depends on how you implemented the previous tasks. You will be using many (if not all) the features you posted in those functions.

at least give me some idea about the 4th task thanks

Do you know how to calculage an average? Total / number of items. So to get average weight you need to loop through the array summing up the weights, then divide that sum by the total number of weights. Same with height and bmi.

Task Four:
Design and implement a function that takes uses the contents of the data in the array (once again passed as an argument) and displays at the following information:
• average weight
• average height
• average BMI

void calculation(double height[5], double weight[5], double BMI[5])
{
     //Do some calculations on the height, weight and BMI to get what you want....
}
void calculation(double height[5], double weight[5], double BMI[5])
{
     //Do some calculations on the height, weight and BMI to get what you want....
}

well thanks for that...
just last help...
can u make a Menu for me????
please..

Err.... Pads, Give you some hint on the menu.
Just use cout and a few switch(). Give it a try first. The best way to learn is to try it your self. ;)

***Hi, jason102178. If you want to post a question. Please open a new thread. :)

Your homework reads design a function , is it a C++ project assignment or C assignment ?

You can't come here and expect us to do everything. From what I read you have some of the functions done (part 1 and 2 right?) let us see that so we can further help you with parts 3 and 4 and see that you have really attempted to do the work but did get stuck. Also as Ancient Dragon pointed out parts 3 and 4 depend on how you made parts 1 and 2, so we would have to see them to do the rest. I'll try writting something to give you some help along the way, but post parts 1 and 2 first! ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.