Return to course web page: [James Tam]   Return to course web page: [Nathaly Verwaal]

CPSC 231: Assignment 2

Due October 21 at 4 PM

New Concepts to be applied for the assignment

Introduction

Each day a person takes in calories through nutrients. Calories are expended through normal metabolism needed to keep the body functioning (e.g. sleeping, breathing, sitting, walking etc.) and through more strenuous activities (e.g. running, exercise etc.). The difference between calories taken in and expended can be used to determine if body mass increases or decreases over time.

The computation for calories expended is different for men and women. You will create an application for either men or women (your choice) that computes the amount of calories expended based on the users input.

Calories expended during normal metabolism

A formula can be used to determine daily calories expended during regular daily activities is derived by Mifflin et. al 1990.1  For this assignment we'll used the simplified version of this formula (which is equally accurate according to the authors of the paper). The formulas for each gender is as follows.

Before

After (use this one, a small change in the bracketing produces a slightly different result)

Weight = weight in kilograms (1 pound =  0.45359237 kilograms)
Height = height in centimeters (1 inch = 2.54 centimeters)
Age = age in years

Potentially any of these values can be integer or real numbers (e.g. 63 kilograms, 32.5 years).

Calories expended while working out

Although there have been ways of estimating calories expended while working out e.g., walk = 200 calories per hour, jog = 400, run = 800 etc. important factors such as body mass and age have largely been left out. Furthermore the workout intensity has been largely left to imprecise estimates (exactly what speed constitutes a jog vs. a run).

A more precise method of determining calories expended while working out was derived by Keytel et al 20052. There is a different formula used for each gender:

Before

After (use this one, increases in weight increases caloric expenditure, changed part bolded):

Age = age in years
Weight = weight in pounds
Heart rate = average heart rate (beats per minute) while working out
Time = workout duration in minutes

Again any of these values can be integer or real numbers.

Assignment description

You need to write a program that will prompt the user to enter all information needed to compute their caloric expenditure for an average day. Consider the formulas above to see what information you need from the user. Note that total caloric expenditure is the sum of the calories expended during normal metabolism and the calories expended while working out.

Make sure you ask the user for the information in measurements that they are most likely to know. For example, most people in Canada know their weight in pounds, not in kilograms.

The output of your program should be neat and presentable and the program should round fractional values to one fractional digit e.g., 100.55 is displayed as 100.6.

You also keep in mind that your program needs to be decomposed into functions. Not only will you be marked on functionality (does the program implement the above features) but part of your grade for this assignment will be determined by: how logical and balanced is your decomposition (i.e., your program should not just consist of one 'super function' that implements most of the program's functionality), and how well designed are your functions (e.g., a function should implement one well defined task). For additional details principles of good design of functions see the lecture/course notes provided by your instructor.

Reminders

References (sources for the formulas used in the assignment description):

  1. "A new predictive equation for resting energy expenditure in healthy individuals", Mifflin M.D., St. Jeor S.T., Hill L. A., Scott B.J., Saugherty S.A., Young O.K., American Journal of Clinical Nutrition 1990 (Vol .51, No. 2): pp. 241 - 247.
  2. "Prediction of energy expenditure from heart rate monitoring during submaximal exercise.", Keytel L.R., Goedecke J.H., Noakes T.D., Hiiloskorpi H., Laukkanen R., van der Merwe L., Lambert E.V., Journal of Sports Sciences 2005 (Vol. 23, No 3): pp. 289 - 297.