Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need python code for this problem. I have Pseudocode and Algorithm. My python code has to be based on my pseudocode, If not my

I need python code for this problem. I have Pseudocode and Algorithm. My python code has to be based on my pseudocode, If not my instructor will deduct my grade a lot. Thanks.

Algorithm:

Ask the user to enter the person weight and height

Calculate the body mass index (BMi) of that person

If body mass index is greater than or equal to 18.5 And less than or equal to 25 then

Display a message saying the person has optimal weight for their height.

Otherwise, If body mass index if less than 18.5, then display a message saying the person has underweight for their height.

Other, If body mass index if greater than 25, then display a message saying the person has overweight for their height.

Pseudocode

// Declare the variables

Declare Real weight

Declare Real height

Declare Real bodyMassIndex

//Read the weight and height of a person

Display Enter the weight of a person in pounds.

Input Weight

Display Enter the height of a person in inches.

Input height

// Calculate the body mass index (BMI)

Set bodyMassIndex = Weight * 703 / (height * height)

// Checks the body mass index of a person

If bodyMassindex >= 18.5 And bodyMassIndex <=25 Then

Display A person has optimal weight for their

height.

Else If bodyMassIndex < 18.5 Then

Display A person has underweight for their

height.

Else If bodyMassIndex > 25 Then

Display A sperson has overweight for their

height.

End if

Problem

Write a program that calculates and displays a persons body mass index (BMI). The BMI is often used to determine whether a person with a sedentary lifestyle is overweight or underweight for his or her height. A persons BMI is calculated with the following formula:

BMI = weight x 703 / height2

where weight is measured in pounds and heightis measured in inches. The program should ask the user to enterhis/her weight and height. The program should display a message indicating whether the person has optimal weight, is underweight, or is overweight. A sedentary persons weight is considered optimal if his or her BMI is between18.5 and 25. If the BMI is less than 18.5, the person is considered underweight. If the BMI valueis greater than 25, the person is considered overweight

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions

Question

3. Explain the forces that influence how people handle conflict

Answered: 1 week ago