Results 1 to 2 of 2

Math Help - Calculation of a BOGOF deal - Should be easy

  1. #1
    Newbie
    Joined
    Sep 2010
    Posts
    1

    Calculation of a BOGOF deal - Should be easy

    Hi,

    I'm not sure if this is in the right place but I'm trying to develop logic for a promotions mechanic for some software. The example deal I'm working with is as follows:

    Buy 2 cases - get 2 bottles free
    Buy 3 cases - get 3 bottles free
    Buy 10 cases - get 12 bottles free

    I buy 5 cases - I get 5 bottles free (2,3)
    I buy 7 cases - I get 7 bottles free (2,2,3)
    I buy 13 cases - I get 15 bottles free (10,3)
    etc....

    The problem comes when I'm trying to program the logic on the 2 and 3 case deals. Because the ratio of free stock is the same, the calculations throw up all sorts of issues. Also, this is just one example....it could be a buy 5 get - 5 free / buy 12 get 15 free.... so in effect, a formula that can be used against any sort of promotion is needed.

    I'd appreciate any help on this one, it's driving me mad!!

    Thanks

    Matt
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Joined
    Dec 2007
    From
    Ottawa, Canada
    Posts
    3,173
    Thanks
    74
    Quote Originally Posted by matthewwookie View Post
    Buy 2 cases - get 2 bottles free
    Buy 3 cases - get 3 bottles free
    Buy 10 cases - get 12 bottles free
    Problem seems to be ONLY when number of cases ends with a 1; like 11, 21 ....
    Like, with 10 or 11, you get 12 free, but with 12, you get 14 free; right?
    So, after calculating the 10's, skip if remainder = 1; example:
    51 cases: INT(51/10) = 5; free = 5 * 12 = 60; 51 - 5*10 = 1 : skip
    53 cases: INT(51/10) = 5; free = 5 * 12 = 60; 53 - 5*10 = 3 : free = free + 3 = 60 + 3 = 63
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. FTC2 - Not sure how to deal with this one
    Posted in the Calculus Forum
    Replies: 3
    Last Post: March 31st 2011, 09:18 PM
  2. How to deal with the summation?
    Posted in the Calculus Forum
    Replies: 1
    Last Post: March 24th 2011, 05:13 AM
  3. How do i deal with fractions when using Modulo?
    Posted in the Number Theory Forum
    Replies: 3
    Last Post: February 11th 2011, 02:25 PM
  4. How to deal with undefined limits?
    Posted in the Calculus Forum
    Replies: 6
    Last Post: January 3rd 2011, 10:30 AM
  5. help! how to deal with negative fractions?
    Posted in the Algebra Forum
    Replies: 13
    Last Post: September 24th 2006, 06:36 PM

Search Tags


/mathhelpforum @mathhelpforum