UML of the RecipeBook, Recipe, and Ingredient classes: UML…
UML of the RecipeBook, Recipe, and Ingredient classes: UML of Ingredients.pdf Given the UML diagram, write the code for the method called calculateCalories() found in the Recipe class. This method iterates through each Ingredient object in the Ingredients ArrayList in the Recipe class. As it iterates through all the Ingredient objects, calculate the calories of each Ingredient by multiplying the caloriesPerUnit times the qtyOfUnits, both found in the Ingredient object, giving a subtotal for that ingredient. Accumulate all the subtotals and return the total calories double value. public double calculateCalories() { …}