This is surely way below the level of maths questions you normally get on here but please humor me!
I have written a simple app that compares beer offers and works out the best (cheapest) price per 100ml. It works it out using the calculation written below:
function getPricePer100ml(cansize, cansinpack, numberofpacks, cost) { var totalCans = cansinpack * numberofpacks; var totalMl = totalCans * cansize; var total100Mls = totalMl / 100; return cost / total100Mls; }
I run this twice to get each offers price per 100ml and then the lowest price "wins".
The issue I am having is understanding what I need to do on top of this to factor in the ABV (strength) of the beer. This is in % so for example:
offer1per100ml = 0.65p - 3.8%ABV offer2per100ml = 0.75p - 5.2%ABV
My app would class offer 1 as the winner because its cheaper per 100ml but I suspect that you get more bang for your buck by paying the extra 10p and buying the strong stuff.
How can I write this mathematically? Or am I approaching this wrong?
Thanks for your input!