Question
BY USING MATLAB ONLY. Problem: A growing number of people are becoming more health conscious watching their diet and exercising more. Statistics are available to
BY USING MATLAB ONLY.
Problem:
A growing number of people are becoming more health conscious watching their diet and exercising more. Statistics are available to help them monitor their progress toward becoming a healthier person. The body mass index (BMI) is a statistical measure which compares a persons weight and height. Though it does not actually measure the percentage of body fat, it is used to estimate a healthy body weight. The following equation is used to calculate body mass index. Note: The mass is the body weight in kilograms and height is in meters. [http://en.wikipedia.org/wiki/Body_mass_index]
You have discovered equations to calculate the Ideal Body Weight (IBW) and want to add this feature to your program. The following equations are used to compute the IBW, where height is in inches and the IBW is in kilograms. The user will need to specify the gender by entering a character notation, 1 or 2.
IBW (men) = 50.0 + 2.3 * (height - 60) IBW (women) = 45.5 + 2.3 * (height - 60)
Instructions for all assignments scripts:
See Standards for Documentation of MATLAB Programs on the Canvas Resources page.
Insert comments at the top and throughout each file.
o Include the follow comments at the beginning of this (and ALL) files.
% submitters name, GROUP #
% other group members names
% program file name, ex. assign02a.m
% due date of the assignment
% statement about collaboration
% a short narrative about what the file does
o Use the algorithm given as comments throughout your program.
Observe the instructors rule for naming variables.
o Use ALL CAPS for constants variable names.
o Start other variables with lower case.
o Use descriptive variable names.
Use Sample Input/Output as a guide.
Code clarity:
o Indent blocks as needed. Use Smart Indent.
o Divide your solution program code into sections as noted in the algorithm. Use blank lines as needed to group statements.
o Use section comments as well as the algorithm step comments.
o Remove statements from previous assignments that do not apply to the current requirements.
Use comments to show units.
Use the CONSTANT and variable names; not numbers. Exceptions are incrementers and numbers without identity.
No extra output, i.e. use semicolons
Program: assign04a.m
Save your assign03a.m as assign04a.m. Modify the script for the new requirements. Using the algorithm and sample output as a guide, to get the data, determine the BMI and IBW; and display the BMI, BMI category, and Ideal Body Weight for the user-entered gender. Because people make mistakes, all data needs to be validated as correct before using it.
Additional Problem Constants: (with units) None.
Additional Problem Inputs: (with units) gender
Additional Problem Outputs: (with units) IBW in pounds
Additional Other variables: (with units) as needed
Equations: See above and previous assignments.
Algorithm: Use as comments below. See below.
Sample run output: Test with bad and good data.
Enter the height in inches(59-78): 58
Enter the height in inches(59-78): 79
Enter the height in inches(59-78): 72
Enter the weight in pounds(90-350): 85
Enter the weight in pounds(90-350): 355
Enter the weight in pounds(90-350): 165 Is the person a female(1) or male(2)? Enter 1 or 2: 5
Is the person a female(1) or male(2)? Enter 1 or 2: 2
Yesthere is a blank line here.
The BMI is 22.378
BMI Classification:
Normal
The ideal weight for 72 inches is 171.077 pounds.
Start your program file by typing the following into your empty editor window.
Type yours/your group and other required information comments.
Type the algorithm as given below as comments to guide you when writing the MATLAB instructions to do the tasks to solve the given problem.
Below the comment, type the MATLAB statement(s) that do what the comment says.
% submitters name, GROUP #
% other group members names
% program file name % due date of the assignment
% statement(s) about collaboration. See syllabus for examples.
% a short narrative about what the file does; include current requirements
clc, clear all
%*****INPUT*****
% Until good height, prompt user to enter a value for height in inches
% Until good weight, prompt user to enter a value for weight in pounds
% Until good gender, prompt user to enter the gender (1 or 2)
%*****COMPUTE*****
% Compute conversions
% Compute BMI
% Compute the IBW for the given height and gender
% Convert IBW to pounds
%*****OUTPUT*****
% Display BMI
% Display BMI classification
% Display IBW
Program: assign04b.m
Save your assign04a.m as assign04b.m. Modify the script process the health stats for multiple people. Ask the user to enter the number of people.
Additional Problem Constants: (with units) None.
Additional Problem Inputs: (with units) number of people
Additional Problem Outputs: (with units) none
Additional Other variables: (with units) as needed
Equations: See above and previous assignments.
Algorithm: Use as comments below. See below.
Enter number of people for health stats: 3
Yesthere is a blank line here.
Person # 1
Enter the height in inches(59-78): 58
Enter the height in inches(59-78): 79
Enter the height in inches(59-78): 72
Enter the weight in pounds(90-350): 85
Enter the weight in pounds(90-350): 355
Enter the weight in pounds(90-350): 165 Is the person a female(1) or male(2)? Enter 1 or 2: 2
The BMI is 22.378
BMI Classification:
Normal
The ideal weight for 72 inches is 171.077 pounds.
blank line
Person # 2
Enter the height in inches(59-78): 69
Enter the weight in pounds(90-350): 175
Is the person a female(1) or male(2)? Enter 1 or 2: 1
The BMI is 25.843
BMI Classification:
Overweight
The ideal weight for 69 inches is 145.9445 pounds.
blank line
Person # 3
Enter the height in inches(59-78): 68
Enter the weight in pounds(90-350): 130
Is the person a female(1) or male(2)? Enter 1 or 2: 1
The BMI is 19.7664
BMI Classification:
Normal
The ideal weight for 68 inches is 140.8739 pounds.
Start your program file by typing the following into your empty editor window.
Type yours/your group and other required information comments.
Type the algorithm as given below as comments to guide you when writing the MATLAB instructions to do the tasks to solve the given problem.
Below the comment, type the MATLAB statement(s) that do what the comment says.
% submitters name, GROUP #
% other group members names
% program file name
% due date of the assignment
% statement(s) about collaboration. See syllabus for examples.
% a short narrative about what the file does; include current requirements
clc, clear all
%*****INPUT*****
% Enter number of people to process
% For each person
% Until good height, prompt user to enter a value for height in inches
% Until good weight, prompt user to enter a value for weight in pounds
% Until good gender, prompt user to enter the gender (1 or 2)
%*****COMPUTE*****
% Compute conversions
% Compute BMI
% Compute the IBW for the given height and gender
% Convert IBW to pounds
%*****OUTPUT*****
% Display BMI
% Display BMI classification
% Display IBW
I HAVE ATTACHED THE PICTURE SOLUTION OF assign03a.m, IT'S NEEDED FOR assign04a.m.
SeetionS Editor- HACOMP1200lassign03a.m dassign0Ba.m moe using course macerial and displays the EMT plays the BMI classificatt 15 to enter a value fo Neigh 18 tBnter the veight in por 20 21 betoh geight xeighs 54) /100: 1bs 2.2046 25 26 27 b eight disp(' ') 34 3disp ('3Mr Classification: ' 36 37 Display Bwr claRification is bos
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started