This is my problem:
If someone buys a ticket for day1, he/she receives 2 free drinks.
If someone buys a ticket for day2, he/she receives 2 free drinks.
If someone buys a ticket for day3, he/she receives 1 free drink.
If someone buys a ticket for day1 AND day2, he/she receives 5 free drinks.
This is how it looks like:
tickets_day1 tickets_day2 tickets_day3 free_drinks
2 0 1 5 (4 + 1)
0 2 0 4 (4)
1 1 0 5 (5)
2 3 0 12 (5 + 5 + 2)
2 1 4 11 (5 + 2 + 4)
For example, someone orders the following tickets:
tickets_day1 tickets_day2 tickets_day3 free_drinks
6 3 1 22
Then the following should happen:
6 3 1
1x 1 1 1 = 6 free drinks
1x 1 1 0 = 5 free drinks
1x 1 1 0 = 5 free drinks
1x 1 0 0 = 2 free drinks
1x 1 0 0 = 2 free drinks
1x 1 0 0 = 2 free drinks
Add up those free drinks = 22 free drinks!
How do i do this? Or is there another solution to my problem?