Problem StatementBalaji wants your help to design a fitness calculator. The simple measure of body fitness is the BMI or Body Mass Index. It depends only on the height L and weight W of a person. It is defined as BMI = [weight / height2] where weight is taken in kilograms and length in meters. Four general grades are proposed:Underweight[U] - when BMI < 18.5Normal weight[N] - 18.5 <= BMI < 25.0Heavyweight [H] - 25.0 <= BMI < 30.0Overweight [O] - above or equal to 30.0Write a program that takes in the Weight (in Kg) and Length (in meters) of an individual and displays the grade as U, N, H, O.Note: Store all the variables in register memory.Input format :The first line of input consists of an integer, representing the weight.The second line consists of a double value, representing the height in meters.Output format :The output displays the grade based on the given conditions.Refer to the sample output for the formatting specifications.Code constraints :In the given scenario, the test cases will fall under the following constraints:60 ≤ weight ≤ 2001.0 ≤ height ≤ 5.0Sample test cases :Input 1 :1303.5Output 1 :UInput 2 :2002.7Output 2 :HInput 3 :902.1Output 3 :NInput 4 :741.3Output 4 :O
Question
Problem StatementBalaji wants your help to design a fitness calculator. The simple measure of body fitness is the BMI or Body Mass Index. It depends only on the height L and weight W of a person. It is defined as BMI = [weight / height2] where weight is taken in kilograms and length in meters. Four general grades are proposed:Underweight[U] - when BMI < 18.5Normal weight[N] - 18.5 <= BMI < 25.0Heavyweight [H] - 25.0 <= BMI < 30.0Overweight [O] - above or equal to 30.0Write a program that takes in the Weight (in Kg) and Length (in meters) of an individual and displays the grade as U, N, H, O.Note: Store all the variables in register memory.Input format :The first line of input consists of an integer, representing the weight.The second line consists of a double value, representing the height in meters.Output format :The output displays the grade based on the given conditions.Refer to the sample output for the formatting specifications.Code constraints :In the given scenario, the test cases will fall under the following constraints:60 ≤ weight ≤ 2001.0 ≤ height ≤ 5.0Sample test cases :Input 1 :1303.5Output 1 :UInput 2 :2002.7Output 2 :HInput 3 :902.1Output 3 :NInput 4 :741.3Output 4 :O
Solution
To solve this problem, you can follow these steps:
Step 1: Take the weight and height as input from the user. The weight should be an integer and the height should be a double value.
Step 2: Calculate the BMI using the formula BMI = weight / (height * height).
Step 3: Based on the calculated BMI, determine the fitness grade. If the BMI is less than 18.5, the grade is 'U' (Underweight). If the BMI is between 18.5 and 25.0, the grade is 'N' (Normal weight). If the BMI is between 25.0 and 30.0, the grade is 'H' (Heavyweight). If the BMI is 30.0 or above, the grade is 'O' (Overweight).
Step 4: Display the fitness grade to the user.
Here is a Python code snippet that implements these steps:
#
Similar Questions
John is a fitness trainer and needs to calculate the Body Mass Index (BMI) for his clients to assess their health status. Write a program for him that takes the weight in kilograms and height in meters of a client as input, calculates their BMI, and determines if they fall within the healthy range.Note: The healthy range of BMI is 18.5 to 24.9 (both inclusive).Input format :The input consists of two double values: the weight in kilograms and the height in meters.Output format :The first line of output prints "BMI: X" where X is a double value, rounded off to two decimal places.The second line prints one of the following:If the BMI is within the valid range, print "Healthy Range".Otherwise, print "Not in Healthy Range".Refer to the sample output for formatting specificationsCode constraints :10.0 ≤ weight ≤ 300.00.00 ≤ height ≤ 3.00Sample test cases :Input 1 :65.81.75Output 1 :BMI: 21.49Healthy RangeInput 2 :124.31.87Output 2 :BMI: 35.55Not in Healthy Range
BMI CalculatorCreate an application which calculates BMI (Body Mass Index)Your app should have 2 input boxesTake weight in kgs from userTake height in meters from userBased on entered height and weight calculate BMI of that personHere is the formula for manually calculating BMI BMI = (weight) / (height * height)From the obtained BMI result, display whether the person isUnderWeight - bmi <= 18.4Normal Weight - bmi >= 18.5 && bmi <= 24.9Overweight - bmi >= 25 && bmi <= 29.9Obese - bmi >= 30Hint: use If conditionsSample Output
Star Fitness Club wants to calculate the Body Mass Index (BMI) for all its customers. Customers may enter their height and weight. Each customer should know their body mass index and weight loss or gain goals to be fit and healthy. Help them to achieve this with the help of a Java program. The formula for calculating BMI is weight/((height/100) *(height/100)).Display the bmi with respect to 2 decimal points.If bmi is greater than or equal to 25, print "You are overweight" and then print the number of kilograms to be reduced to become fit as "Reduce <<kgs>>kg to be fit".If bmi is less than 25 and greater than or equal to 18.5, print "You are fit and healthy".If bmi is less than 18.5, print "You are underweight" and then print the number of kilograms to be gained to become fit as "Gain <<kgs>>kg to be fit".Note:In the Sample Input / Output provided, the highlighted text in bold corresponds to the input given by the user, and the rest of the text represents the output.Ensure to follow the object-oriented specifications provided in the question description.Ensure to provide the names for classes, attributes, and methods as specified in the question description.Adhere to the code template, if provided.Please do not use System.exit(0) to terminate the program. Sample Input 1:Enter weight in kg108Enter height in cm168Sample Output 1:Your BMI is 38.27. You are overweightReduce 13.27 kg to be fitSample Input 2:Enter weight in kg68Enter height in cm172Sample Output 2:Your BMI is 22.99. You are fit and healthySample Input 3:Enter weight in kg42.7Enter height in cm158Sample Output 3:Your BMI is 17.10. You are underweightGain 1.40 kg to be fit
The Body Mass Index (BMI) is the ratio of the weight of a person(in kilograms) to the square of the height(in meters)Formula To Calculate Body Mass Index (BMI)BMI = weight / (height x height);Write a JavaScript program that calculates the BMI, and reports the BMI category as per the following table:BMI Category BMIUnderweight below 18.5Healthy 18.6 to 24.9Overweight 25 to 25.9Obese Obese 30 or greaterInput Data
BMI is calculated as:Question 5Select one:a.Length X Breath X Heightb.Weight 2 / Heightc.Height2/ Weightd.Weight / Height2
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.