hot_spaceship_smoothies

Hot Spaceship Smoothies

By: Rex Lee

NutrientsOriginal Daily ValueUpdated Daily Value
Calcium1 g1.3 g
Fiber25 g28 g
Fat65 g78 g
Vitamin D40mg80mg
Sodium2.4 g2.3 g
Iron18 mg18 mg
Protein50 g50 g
carbs225 g325 g
======== So Here’s Our Ingredients For Recipe 3 ========
=====150 ml In total for smoothie =====
===== nuts 4.6 g =====
Calcium 5.38mg 117 mg
Fiber 0.575 g 12.5 g
Fat 2.297 g 49.93 g
Vitamin D 0 mg 0 mg
Sodium 12.5 mg 273 mg
Iron 0.11 mg 2.6 mg
Protein 0.9729 g 21.15 g
carbs 0.9913 g 21.55 g
=====almond milk 120 g =====
Calcium 221mg 184 mg
Fiber 0.24g 0.20 g
Fat 1.2g 1.0 g
Vitamin D0mg 0 mg
Sodium86.4 mg 72.0 mg
Iron0.36mg 0.30 mg
Protein0.48 g 0.40 g
carbs1.56 g 1.30 g
===== banana 39 g =====
Calcium2 mg 5 mg
Fiber1.01 g 2.60 g
Fat0.12 g 0.30 g
Vitamin D0 mg 0 mg
Sodium0.4 mg 1 mg
Iron0.12 mg 0.30 mg
Protein0.43 g 1.1 g
carbs9.0 g 23 g
===protein calculator ===
function sumArray (inputArray) {
  let sum = 0;
  for (let i = 0; i < inputArray.length; i++) {
    sum = sum + inputArray[i]
  }
  return sum}

class Ingredient {
    constructor (name,amountInDish,ProteinAmount100g,CarbsAmount100g,FatAmount100g,FiberAmount100g,
 SodiumAmount100mg, CalciumAmount100mg, IronAmount100mg,VitaminDAmount100mg,CaloriesAmount100g)
    { this.name = name;
      this.amountInDish = amountInDish;
      this.ProteinAmount100g = ProteinAmount100g;
      this.CarbsAmount100g = CarbsAmount100g;
      this.FatAmount100g = FatAmount100g;
      this.FiberAmount100g = FiberAmount100g;
      this.SodiumAmount100mg = SodiumAmount100mg;
      this.CalciumAmount100mg = CalciumAmount100mg;
      this.IronAmount100mg = IronAmount100mg;
      this.VitaminDAmount100mg = VitaminDAmount100mg;
      this.CaloriesAmount100g = CaloriesAmount100g;
      this.calculatedProtein = undefined;
      this.calculatedCarbs = undefined;
      this.calculatedFat = undefined;
      this.calculatedFiber = undefined;
      this.calculatedSodium = undefined;
      this.calculatedCalcium = undefined;
      this.calculatedIron = undefined;
      this.calculatedVitaminD = undefined;
      this.calculatedCalories= undefined;
      this.calculatedPercentage=undefined;
     }}


 let allIngredient = [
new Ingredient ('nuts', 4.6, 0.9913, 2.27, 0.575, 12.5, 5.38, 0.11, 0, 1.3, 144),
new Ingredient ('almond milk',120, 0.48, 1.56, 1.2, 0.24, 86.4, 221, 0.36, 0, 20),
new Ingredient ('banana', 39, 0.43, 9, 0.12, 1.01, 0.4, 2, 0.12, 0, 88.7),
]

function calculatedSmoothie (IngredientObject){
//Protein
  IngredientObject.calculatedProtein = IngredientObject.ProteinAmount100g / 100 * IngredientObject.amountInDish
//Carbs
  IngredientObject.calculatedCarbs = IngredientObject.CarbsAmount100g / 100 * IngredientObject.amountInDish
//Fat
     IngredientObject.calculatedFat = IngredientObject.FatAmount100g / 100 * IngredientObject.amountInDish
//Fiber
      IngredientObject.calculatedFiber = IngredientObject.FiberAmount100g / 100 * IngredientObject.amountInDish
//Sodium
  IngredientObject.calculatedSodium = IngredientObject.SodiumAmount100mg / 100 * IngredientObject.amountInDish
//Calcium
    IngredientObject.calculatedCalcium = IngredientObject.CalciumAmount100mg / 100 * IngredientObject.amountInDish
//Iron
      IngredientObject.calculatedIron = IngredientObject.IronAmount100mg / 100 * IngredientObject.amountInDish
//VitaminD
    IngredientObject.calculatedVitaminD = IngredientObject.VitaminDAmount100mg / 100 * IngredientObject.amountInDish
//Calories
 IngredientObject.calculatedCalories = IngredientObject.CaloriesAmount100g / 100 * IngredientObject.amountInDish;
 return IngredientObject
}

//function nutritionPrinter (inputArray, totalAmount, Ingredients, totalProtein, totalCarb, totalFat, totalFiber, totalIron, totalSodium, totalCalcium, totalVitaminD, totalCalories) {
function nutritionPrinter (inputArray) {
  inputArray.forEach(i => {
      console.log("the ingredient name is",i.name);
      console.log("the ingredient amount is ",i.amountInDish);
      console.log("the amount of protein",i.ProteinAmount100g);
      console.log("the amount of carbs", i.CarbsAmount100g);
      console.log("the amount of fat",i.FatAmount100g);
      console.log("the amount of fiber",i.FiberAmount100g);
      console.log("the amount of iron",i.IronAmount100mg);
      console.log("the amount of sodium",i.SodiumAmount100mg);
      console.log("the amount of calcium",i.CalciumAmount100mg);
      console.log("the amount of vitaminD",i.VitaminDAmount100mg)
      console.log("the amount of Calories",i.CaloriesAmount100g)
      })
}

function totalNutrition (IngredientArray) {
  IngredientArray = IngredientArray.map(calculatedSmoothie)
let allProteinValues = IngredientArray.map(o => o.calculatedProtein)
  let allCarbValues = IngredientArray.map(o => o.calculatedCarbs)
  let allFatValues = IngredientArray.map(o => o.calculatedFat)
  let allFiberValues = IngredientArray.map(o => o.calculatedFiber)
  let allIronValues = IngredientArray.map(o => o.calculatedIron)
  let allSodiumValues = IngredientArray.map(o => o.calculatedSodium)
  let allCalciumValues = IngredientArray.map(o => o.calculatedCalcium)
  let allVitaminDValues = IngredientArray.map(o => o.calculatedVitaminD)
  let allCaloriesValues = IngredientArray.map(o => o.calculatedCalories)
  let allWeightValues = IngredientArray.map(o => o.amountInDish)
 //console.log(allWeightValues)
let totalProtein = sumArray (allProteinValues)
  let totalCarb = sumArray (allCarbValues)
  let totalFat = sumArray (allFatValues)
  let totalFiber = sumArray (allFiberValues)
  let totalIron = sumArray (allIronValues)
  let totalSodium = sumArray (allSodiumValues)
  let totalCalcium = sumArray (allCalciumValues)
  let totalVitaminD = sumArray (allVitaminDValues)
  let totalCalories = sumArray (allCaloriesValues)
  let totalWeight = sumArray (allWeightValues)
//nutritionPrinter (IngredientArray, totalProtein, totalCarb, totalFat, totalFiber, totalIron, totalSodium, totalCalcium, totalVitaminD,totalCalories)
nutritionPrinter (IngredientArray)
//console.log(allIngredient)
let nutritionObj =
{
  name:'smoothie',
  ingredients: IngredientArray,
  protein: totalProtein,
  carb: totalCarb,
  fat: totalFat,
  fiber: totalFiber,
  iron: totalIron,
  sodium: totalSodium,
  calcium: totalCalcium,
  vitaminD: totalVitaminD,
  calories: totalCalories,
  weight: totalWeight,
}
console.log('the name of this dish is ',  nutritionObj.name);
console.log('the total amount of protein is ', nutritionObj.protein);
console.log('the total amount of carb is ', nutritionObj.carb);
console.log('the total amount of fat is ', nutritionObj.fat);
console.log('the total amount of fiber is ', nutritionObj.fiber);
console.log('the total amount of iron is ', nutritionObj.iron);
console.log('the total amount of sodium is ', nutritionObj.sodium);
console.log('the total amount of calcium is ', nutritionObj.calcium);
console.log('the total amount of vitaminD is ', nutritionObj.vitaminD);
console.log('the total amount of calories is ', nutritionObj.calories);
console.log('the total amount of weight is ', nutritionObj.weight);
return nutritionObj
}


smoothie1 = totalNutrition(allIngredient)

smoothie1.ingredients[0]

function calculateServing (nutritionObj) {
    let ratio = 100/nutritionObj.weight;
    for (nutrition in nutritionObj) {
       if (!isNaN(nutritionObj[nutrition]))
       {nutritionObj[nutrition] = nutritionObj[nutrition] * ratio}
    };
    return nutritionObj
}

!isNaN('hi')
!isNaN(10)

smoothie1100g = calculateServing(smoothie1)

===== output =====
smoothie1100g = calculateServing(smoothie1)
VM611:76 the ingredient name is empty
VM611:77 the ingredient amount is  300
VM611:78 the amount of protein 0.7
VM611:79 the amount of carbs 18.9
VM611:80 the amount of fat 1
VM611:81 the amount of fiber 4.2
VM611:82 the amount of iron 0.3
VM611:83 the amount of sodium 1.6
VM611:84 the amount of calcium 12.4
VM611:85 the amount of vitaminD 0
VM611:86 the amount of Calories 79
VM611:76 the ingredient name is empty
VM611:77 the ingredient amount is  350
VM611:78 the amount of protein 3.6
VM611:79 the amount of carbs 12.8
VM611:80 the amount of fat 5
VM611:81 the amount of fiber 0
VM611:82 the amount of iron 0
VM611:83 the amount of sodium 57
VM611:84 the amount of calcium 106
VM611:85 the amount of vitaminD 0
VM611:86 the amount of Calories 113
VM611:76 the ingredient name is empty
VM611:77 the ingredient amount is  725
VM611:78 the amount of protein 3.2
VM611:79 the amount of carbs 4.8
VM611:80 the amount of fat 3.3
VM611:81 the amount of fiber 0
VM611:82 the amount of iron 0
VM611:83 the amount of sodium 43
VM611:84 the amount of calcium 113
VM611:85 the amount of vitaminD 1.3
VM611:86 the amount of Calories 61
VM611:76 the ingredient name is empty
VM611:77 the ingredient amount is  0
VM611:78 the amount of protein 0
VM611:79 the amount of carbs 0
VM611:80 the amount of fat 0
VM611:81 the amount of fiber 0
VM611:82 the amount of iron 0
VM611:83 the amount of sodium 0
VM611:84 the amount of calcium 0
VM611:85 the amount of vitaminD 0
VM611:86 the amount of Calories 0
VM611:76 the ingredient name is empty
VM611:77 the ingredient amount is  150
VM611:78 the amount of protein 3.2
VM611:79 the amount of carbs 4.8
VM611:80 the amount of fat 3.3
VM611:81 the amount of fiber 0
VM611:82 the amount of iron 0
VM611:83 the amount of sodium 43
VM611:84 the amount of calcium 113
VM611:85 the amount of vitaminD 1.3
VM611:86 the amount of Calories 61
VM611:76 the ingredient name is empty
VM611:77 the ingredient amount is  200
VM611:78 the amount of protein 0.6
VM611:79 the amount of carbs 7.6
VM611:80 the amount of fat 0.2
VM611:81 the amount of fiber 0.4
VM611:82 the amount of iron 0.2
VM611:83 the amount of sodium 1
VM611:84 the amount of calcium 7
VM611:85 the amount of vitaminD 0
VM611:86 the amount of Calories 30
VM611:76 the ingredient name is empty
VM611:77 the ingredient amount is  300
VM611:78 the amount of protein 0.5
VM611:79 the amount of carbs 13
VM611:80 the amount of fat 0.1
VM611:81 the amount of fiber 1.4
VM611:82 the amount of iron 13
VM611:83 the amount of sodium 0.3
VM611:84 the amount of calcium 1
VM611:85 the amount of vitaminD 0
VM611:86 the amount of Calories 50
VM611:76 the ingredient name is nuts
VM611:77 the ingredient amount is  4.6
VM611:78 the amount of protein 0.9913
VM611:79 the amount of carbs 2.27
VM611:80 the amount of fat 0.575
VM611:81 the amount of fiber 12.5
VM611:82 the amount of iron 0
VM611:83 the amount of sodium 5.38
VM611:84 the amount of calcium 0.11
VM611:85 the amount of vitaminD 1.3
VM611:86 the amount of Calories 144
VM611:76 the ingredient name is almond milk
VM611:77 the ingredient amount is  120
VM611:78 the amount of protein 0.48
VM611:79 the amount of carbs 1.56
VM611:80 the amount of fat 1.2
VM611:81 the amount of fiber 0.24
VM611:82 the amount of iron 0.36
VM611:83 the amount of sodium 86.4
VM611:84 the amount of calcium 221
VM611:85 the amount of vitaminD 0
VM611:86 the amount of Calories 20
VM611:76 the ingredient name is banana
VM611:77 the ingredient amount is  39
VM611:78 the amount of protein 0.43
VM611:79 the amount of carbs 9
VM611:80 the amount of fat 0.12
VM611:81 the amount of fiber 1.01
VM611:82 the amount of iron 0.12
VM611:83 the amount of sodium 0.4
VM611:84 the amount of calcium 2
VM611:85 the amount of vitaminD 0
VM611:86 the amount of Calories 88.7
VM611:131 the name of this dish is  smoothie
VM611:132 the total amount of protein is  46.1892998
VM611:133 the total amount of carb is  203.18642
VM611:134 the total amount of fat is  51.58824999999999
VM611:135 the total amount of fiber is  18.8569
VM611:136 the total amount of iron is  40.7788
VM611:137 the total amount of sodium is  687.5334799999998
VM611:138 the total amount of calcium is  1679.9350599999998
VM611:139 the total amount of vitaminD is  11.4348
VM611:140 the total amount of calories is  1441.467
VM611:141 the total amount of weight is  2188.6
  • hot_spaceship_smoothies.txt
  • Last modified: 2022/06/24 02:26
  • by howard.lee