Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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!

share|improve this question
3  
Right now you're computing the cost per 100ml. Instead you could be computing the cost per ml of alcohol. If you take the total number of ml and multiply by ABV, then you get the number of mls of alcohol. Dividing as you did before will indicate the cheapest way to get wasted. –  anthonyquas Jun 25 '12 at 21:01
1  
Why isn't taste somehow figured in this?! –  Joe Jun 25 '12 at 21:04
    
We're calculating in the GWQ metric –  anthonyquas Jun 25 '12 at 21:32
    
haha thanks I'll try plugging that in tonight - is that the get wasted quickest metric? :) –  rtpHarry Jun 27 '12 at 7:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.