Project 3
Exercise Logger
- Total Points: 25
- Due: Week 12 (Friday by 11:59pm)
Problem
You’ll often need to calculate values based on a formula that will differ based on various inputs. For example to get a rough calculation of the number of calories you burn while exercising requires knowing your heart rate and the duration of the exercise. Additionally, the calculation is different based on your gender.
You Will create a program that logs your exercise activity and calculates the number of calories burned. The formula for determining calorie burn is:
-
Male:
- ((-55.0969 + (0.6309 * HR) + (0.090174 * W) + (0.2017 * A)) / 4.184) * T
-
Female:
- ((-20.4022 + (0.4472 * HR) – (0.057288 * W) + (0.074 * A)) / 4.184) * T
-
Non Binary:
- ((-37.7495 + (0.5391 * HR) + (0.01644 * W) + (0.1379 * A)) / 4.184) * T
Where:
HR
: Heart rate (in beats/minute)W
: Weight (in pounds)A
: Age (in years)T
: Exercise duration time (in minutes)
This formula was taken from: http://www.shapesense.com/fitness-exercise/calculators/heart-rate-based-calorie-burn-calculator.shtml
Minimum Requrements
-
Must have an Edit Profile page for entering:
- First name
- Last name
- Gender
- Birthdate
- Weight (in pounds)
- A button to save the profile
-
Edit Profile must have access restriction
-
Must have a Log Exercise page for entering:
- Type of exercise. You should have at least 4 exercises to choose from (e.g. running, walking, weightlifing, other, etc.)
- Date of exercise
- Time (in minutes)
- Average heart rate
- A button to log the exercise. When pressing this button, the program must calculate the calories you burned and display the number of calories burned on this page, and log the exercise (including calories burned) to the database.
-
Must have a View Profile page that will display:
- First name
- Last name
- Gender
- Birthdate
- Weight (in pounds)
- The View Profile page must also display a table with the latest exercise entries (up to the last 15):
- Displayed from newest to oldest
- Each entry displayed will list:
- the date of the exercise
- the type of exercise
- the time in minutes
- the average heart rate
- the calories burned
- Each entry must contain a link to remove it from the database
- You must have a database with an
exercise_log
table that contains the following fields:id
(set as the primary key)user_id
(for linking to theexercise_user
tabledate
exercise_type
time_in_minutes
heartrate
calories
- Your database will also have an
exercise_user
table that contains the following fields:id
(set as the primary key)first_name
last_name
gender
birthdate
weight
NOTE: creating a separate table for users is more useful if you were to create a login system for multiple users. See extra credit below.
- All field entries must be validated
- All field entries must be sticky
Extra Credit: 5 points
- Add the ability to have multiple users
- This will require you to add a password column to the exercise_user table
Sample Output
- Your Edit Profile page might look something like this:
Note: It is not required to choose and save a picture
-
Your Log Exercise page might look something like this:
-
Your exercise types might look like this:
-
Your View Profile page might look something like this:
Constraints
- Ensure your numeric fields only takes numeric data
- Validate all field entries
- Make sure profile data fields are sticky
Notes
- Consult http://php.net/manual/en/ref.math.php for PHP math functions
Directions
- Create a folder called
projects/project03
in your php_course_work folder - Code a solution to the problem, keeping all code in your
project03
folder - Remember to make frequent backups
Grading Rubric
- The project must meet the Coding Standards
- The project must run (no errors, and must produce output.) If there are compilation errors or no output, you must fix it before it can be graded
- If there is output, but not all objectives are met from the project, points will be removed for each missing or incorrect item
Submission Instructions
- Show your instructor your completed solution for signoff (Face to face class)
- Create the following screenshots:
- Profile data entered from Edit Profile form
- Exercise data entered from Log Exercise form (for each gender)
- Profile data and logged exercises from View Profile (for each gender)
- Dump your database into the
projects/project3/
directory usingmysqldump
- Compress your
projects/project3/
directory (including your database dump) and submit to Blackboard