Develop an algorithm for the following problem statement. Your solution should be a pseudocode with appropriate comments. You should use modularisation in your solution and provide appropriate error messages (15 marks).
Design a program that receives user height in cm and weight in kg and calculates BMI (body mass index). This program should then print the BMI result and a message based on the following table:
BMI Result Message
BMI = > 25.0 Oops, you are overweight.
18.5 <= BMI < 25 Congrats, you are healthy.
BMI < 18.5 Oops, you are underweight.
Body Mass Index formula is BMI = kg/m2 where kg is a person's weight in kilograms and m2 is their height in metres squared.
Weight should be in kilograms (Minimum 1kg, Maximum 160kg), Height should be in centimetre (Minimum 30cm, Maximum 220cm).
Note: for calculating metres squared(m2), centimetre should be converted to metre then powered by 2.
input: 57 kg 162cm
output: Congrats, you are healthy. Your BMI is 22
Recently Asked Questions
- A couple wants to invest up to $80000. They can purchase a type A bond yielding 11.5% return and a type B bond yielding a 14% return on the amount invested.
- Let f (x) = 4 - x and g (x) = square root x- 3 Find ( f/g ) (12) Find the domain of the quotient function f/g.
- Another display technique that is somewhat similar to a histogram is a dotplot . In a dotplot, the data values are displayed along the horizontal axis. A dot