APCSP (S) Final Project

Task 1

For my APCSP final project I originally wanted to create a wine collectors database for my dad. This would be capable of calculating the cost of the users wine collection. I couldn’t do this project because I emailed requesting an API key for the wine database but I was unable to receive one in time for the project. I ended up creating a weight loss calculator to add to my Fittrack app for my dad. My dad loves to go to the gym as he is trying to lose weight so he tasked me with this. Below you can see an email my dad sent me requesting this.

Task 2

On my fittrack site I had a spot to put my weight loss calculator so I knew I wanted to put it there as it would be a good addition to my project. To plan to create this I decided to create a flow chart that would allow me to see what info I needed to collect to calculate weight loss.  Below you can see this flow chart, it helped me a lot when it came to programming the calculator as I was able to remember everything I needed to get.

Task 3

To create my calculator I had to use my knowledge on how to program JavaScript functions that use math. I also had to use my knowledge of taking input from users to do this task. I started by researching the amount of calories to burn off one kilogram of weight. Then by finding out this information I was able to program the rest of this code with ease. I just created a function called calcWeight() in which the variables were made and calculations were done. The function can be seen below.

function calcWeight() {
var calories = Number(document.getElementById(“calories”).value);
var gym = Number(document.getElementById(“gym”).value);
var pound = document.getElementById(“pound”).value;
var weight = Number(document.getElementById(“weight”).value);
var goal = Number(document.getElementById(“goal”).value);
if (pound == “lb”) weight /= 2.20462;
var weightDif = weight-goal
var kgamount = weightDif*7700
var weightLoss = kgamount/calories
var weeks = weightLoss/gym
weeksone.innerText = weeks;


For this project I only ran into one issue in which my good pal Brandon helped solve. The problem was that I could not have the calculation be printed as I was using a <span> instead of an <h1>. So to solve this I changed it and my code worked fine. Brandon was also very helpful in helping me test my program along the way.

Frontend Backend video

Task 4

In my testing I found that when programming the first time I was calculating the amount of weeks to burn the weight in pounds but not kilograms. But after extensive testing and fixing I was able to make this work for pounds as well. Brandon again helped me test the code as a user to see if it was fully functional to be seen for my client. Once it was up to standard I was done. The one bug that I had that is explained above in which I used <span> instead of <h1> to print the calculated value,  was fixed on 29th May 2017. My code now runs smoothly. From here I got someone not in the class to test it by sending him my uploaded Github website link. Here is what he said.


Task 5

My program working video

Task 6

My code:






Leave a Reply

Your email address will not be published. Required fields are marked *