I am very pleased to present my invention “LST’s Nutrition Comparisioner 1.0”. This was the most exhaustive project I ever did. It took me 6 hours to code the comparisioner and another 6 hours to gently placing it on the website.
Before I go deeply into my hardships in developing this, allow me to explain how it works – JUST PLAY AROUND.
Coming to how it all started, yesterday in my science class I was solving a worksheet I slightly felt annoying to compare which is healthier- the calculation was repetitive. Below is an example of the questions
Of course, there were easy, however, it was time-consuming for me. That led our group behind the class. That made me feel like what can I do to automate the process calculation?
Item A
Item B
Nutrition Facts:
Item A
Item B
function multiplyBy()
{
Aweight = document.getElementById("firstNumber").value;
Afats = document.getElementById("secondNumber").value;
Aprotein = document.getElementById("thirdNumber").value;
Acarbs = document.getElementById("fourthNumber").value;
Aserving = document.getElementById("fifthNumber").value;
document.getElementById("fatresult").innerHTML = "Fats: " + (Aserving * Afats) / Aweight;
document.getElementById("proteinresult").innerHTML = "Protein: " + (Aserving * Aprotein) / Aweight;
document.getElementById("carbohydratesresult").innerHTML = "Carbohydrates: " + (Aserving * Acarbs) / Aweight;
Bweight = document.getElementById("Bweight").value;
Bfats = document.getElementById("Bfat").value;
Bprotein = document.getElementById("Bprotein").value;
Bcarbs = document.getElementById("Bcarbs").value;
Bserving = document.getElementById("Bper").value;
document.getElementById("Bfatresult").innerHTML = "Fats: " + (Bserving * Bfats) / Bweight;
document.getElementById("Bproteinresult").innerHTML = "Protein: " + (Bserving * Bprotein) / Bweight;
document.getElementById("Bcarbohydratesresult").innerHTML = "Carbohydrates: " + (Bserving * Bcarbs) / Bweight;
}