IngredientsPerOrder = function(b,s){
#This function determines the amount of each ingredient required for a given order.
#Parameter b is the name of the cupcake box type.
#Parameter s is the order size.
#Example: an order of 100 gift boxes would have b = “Gift Box” and s = 100.
#It outputs a vector of size 15, each entry represents the amount of one ingredient
#in the order stablished by the rows of the default inventory data frame.
#The output units of measure are pounds or gallons depending on the ingredient.
ib = numeric(15) #This is the output vector.
cc = numeric(7) #This vector contains the number of batches of each cupcake type in the order.
for (j in 1:7){
cc[j] = CupcakePerBox[b,j]*s/12
}
for (i in 1:15){
ib[i]=0
for(j in 1:7){
if (i == 7){ib[i] = ib[i] + IngredientPerBatch[i,j]*cc[j]}
else{
if(i %in% c(9,12,14,15)){ib[i] = ib[i] + IngredientPerBatch[i,j]*cc[j]*0.000264172}
else{ib[i] = ib[i] + IngredientPerBatch[i,j]*cc[j]*0.00220462}
}
}
}
return(ib)
}