hw_4guidesheet.pdf

Page 1 of 6

Homework # 4 ~ Calories Consumed & Burned

Points: 75

Trying to Get Some Exercise

You have decided that you need to start eating better and getting some exercise. Since you like riding

your bike when the weather is nice and you have access to stationary bike when the weather is not good,

you decide to start cycling every day. Also you want to keep better track of the calories you have

consumed throughout the day. At the end of the week you want to know the following:

What is the total calories consumed and burned for each day? Assume that for every minute you

are cycling you burn 10 calories.

What is the deficit or difference between the number of calories you consume and burn?

What is the average calories that you burn and consume?

What day did you consume the highest amount of calories? What day did you burn the highest

calories?

What day did you consume the least amount of calories? What day did you burn the least calories?

Every day you plan on logging in a notebook the total number of calories you consume

(approximately) and how many minutes you spend on either or both bikes. At the end of the week you

plan on loading all of these numbers into a program so that you can analyze the data.

Program Requirements

Your program will need to do the following:

Feature a menu so that all you need to do is enter a letter and the program will perform the

necessary task. Use the following letters to correspond to what the program needs to do:

Menu Option Operation

T Get Total Calories Consumed and Burned. This will also print out

calories consumed and burned per day

D Get the deficit or difference between the total calories consumed and

burned

A Get the averages

H Get the highest calories consumed and burned and the corresponding

days in which this happened

L Get the lowest calories consumed and burned and the corresponding

days in which this happened

E Exit or exits the program

Make sure that whatever choice you make from the menu that it is validated and will not cause the

program to stop prematurely

Allow you to pick numerous tasks before you are done with the program. HINT: you will need a

loop here.

Load both Cycling and Eating amounts when the program loads. In other words, you will not get

prompted to load these values separately. Instead you will initialize your arrays with these

numbers at the beginning of the program.

Nice clean output.

Utilization of modular programming. At the minimum you should have 5 modules.

Some Help with the Logic

This program will need to use numerous modules. After you code each module, run it to test it and

debug it, if necessary. Do not move on to your next module until you have successfully tested the module

you are currently working on.

Page 2 of 6

It is all in the Planning

Open up the planning document or a notepad file and start to figure out what this program needs to

do, the inputs, the outputs, the variables, the 30,000 foot view and your pseudocode. If you do not want

to use the planning document provided, make sure you have all the necessary components in your

notepad file.

Time to Test the Logic

Now that you have planned out your attack, test your logic using Raptor. Use the following test data

to test your program.

Cycling Eating

15 2,600

10 2,400

20 3,500

18 3,200

25 2,700

10 3,300

5 3,000

Here is my output when I selected T in Raptor:

Page 3 of 6

Here is my output when I select D in Raptor

Here is my output when I select A in Raptor

Here is my output when I select H in Raptor

Page 4 of 6

Here is my output when I select L in Raptor

Time to Code

Once you have your Raptor file working, now it is time to translate that to Python. Open up IDLE and

create a new window. Save your file and give it a name. Open your Raptor file and your new window so

that you can see both in your computer screen (like we did in the labs). Translate your Raptor file to

Python. As you are putting this together keep the following in mind:

Remember the proper flow of a program  declare variables at the top, fill the variables, process

the variables and print out the variables

Choose good variable names. These are not too long but descriptive.

Take care with your output. This does need to make sense.

Don’t forget your comments! Points will be deducted.

Since this program is a little longer than your lab programs, test as you go. If you type all of your

code in and then test at the end, your debugging will last longer.

Once you have your code typed in, using the test data above, test your program. My output looked

like the following when I entered T:

Page 5 of 6

When I entered D

When I entered A

When I entered H

When I entered L

Try to get your program to look as much like mine as you can. Utilize the format function and the tab

character to line your output up.

Page 6 of 6

How I Will Be Graded

Please remember that in order to get a C or better in this course, this assignment must be completed. Failure to complete this assignment will result

in a grade of C- or worse.

Exemplary

Competent

Developing

11 Completion of Planning Document

8.8 Planning Document is missing a minor element

6.6 Planning Document is missing a major element

7 Completion of Raptor File 5.6 Raptor file is missing a minor element or has a small bug.

4.2 Raptor file is missing a major element or contains multiple bugs.

2 Comments in the code 1.6 Only one comment in code 1.2 Missing comments

2 Variables declared with appropriate data types and appropriate names

1.6 More than one variable declaration missing or improperly declared

1.2

More than three variables missing. 0 points will be given if there are no declarations. OR was able to complete variable declarations in Raptor file.

3 Displayed menu 2.4 Minor error with the display of the menu

1.8 Major error with the display of the menu or was able to display a menu in Raptor

5 Retrieved the user's choice from the menu and validated it.

4 Minor error with input validation on user's choice.

3 input validation present with a major error OR input validation done correctly in Raptor

8

Get Totals module prints out the total calories burned and consumed. Also prints out the calories burned and consumed for each day.

6.4

Minor error with the print out of each days calories burned and consumed or minor error in the calculation of total calories burned or consumed

4.8

Major error with the print out of each day’s calories burned and consumed or was able to achieve all exemplary items in Raptor.

6

Get Deficit module displays the difference between calories consumed and burned for each day.

4.8 Minor error in the calculation or in the display of the difference.

3.6

Major error in the calculation or in the display of the difference or was able to achieve all exemplary items in Raptor.

5 Get Average module calculates and displays the average calories burned and consumed.

4 Minor error in either average calculation.

3 Major error in either calculation or was able to achieve all exemplary items in Raptor.

7

Get Highest module determines the highest amount of calories burned and consumed. Also determines the corresponding day those values occurred.

5.6

Minor error in determining the highest values and/or day. Amounts or day still are outputted to the user.

4.2

Major error in determining the highest values and or day. One or either are missing from the output or was able to achieve all exemplary items in Raptor.

7

Get Lowest module determines the lowest amount of calories burned and consumed. Also determines the corresponding day those values occurred.

5.6

Minor error in determining the lowest values and/or day. Amounts or day still are outputted to the user.

4.2

Major error in determining the lowest values and or day. One or either are missing from the output or was able to achieve all exemplary items in Raptor.

2

Output looks professional and includes the use of the tab character and the format function.

1.6 Missing one of the required elements.

1.2

Missing more than one of the requirement elements or was able to get all required elements to print in Raptor

65 TOTAL POINTS 52

39.0

Handing it all in

1) Log on to our Angel course shell. Navigate to the Homework #4 Drop Box. Upload your planning

document, your Raptor file and Python file to drop box. Before you upload your files make sure you

click on the rubric to make sure you have everything done.