ITEC 2600 Study Guide - Quiz Guide: Underweight, MoodleExam
Course CodeITEC 2600
This preview shows half of the first page. to view the full 2 pages of the document.
York University ITEC2600 Winter2020 X.Zhou
Introduction to Analytical Programming
Lab Quiz ♯1
1. This is the ﬁrst lab quiz.
2. You could use your lecture notes, reference books, BUT NO discussion, YOU MUST work
out your own solutions.
3. You must submit your lab quiz ﬁle(s) to moodle before 7:00pm, Feb 5, 2020.
4. At the top of each ﬁle introduce your name and student ID as comments.
5. Document your codes/commands well.
1. Body mass index (BMI)is a measure of obesity. In standard units, it is calculated by the
BM I = 703 W
where Wis weight in pounds, and His height in inches. The obesity classiﬁcation is: 1
Below 18.5 Underweight
18.5 to 24.9 Normal
25 to 29.9 Overweight
30 and above Obese
(a) Write an anonymous function to calculate the BMI.
(b) Write a user-deﬁned function to convert the weight from kg to pound, and height from
cm to inch, where 1kg = 2.2046lb, and 1inch = 2.54cm.
(c) You are given a simulated data ﬁle named ‘bodyinfo’xlsx’ that contains weight (in
kg) and height (in cm) for 20 people. The ﬁrst column is the ID number, the second
coulumn is the weight, and third column is the height. Write a program in a script ﬁle
that calculates the BMI of a person. The program reads the weight and height from
data ﬁle, calculate BMI by calling anonymous function in a) and user-deﬁned function
in b), and display the results(rounded to 2 decimal places).
1Textbook: An introduction with Application.
You're Reading a Preview
Unlock to view full version