Hello everyone
First of all, I am hoping that I am posting in the right place.
Second, I have a simple math problem which is used in real world and daily life. Here is the problem:
Me and my friend decided to go to a journey and split all spendings in half (EachPersonShare=TotalSpendings / 2). But the thing is, we both paid for travel charges and fees, meaning that Person1 spended $FirstPersonSpendings and person2 spended $SecondPersonSpendings and we know that $FirstPersonSpendings is not equal (!=) to $SecondPersonSpendings. EachPersonShare is easy, as TotalSpendings= FirstPersonSpendings + SecondPersonSpendings and we know that EachPersonShare = TotalSpendings / 2. But how do we split the money in one transaction that everyone pays according to their spendings (and if one of them spended more than their share, get their money back)? Can you come up with a formula? What if it is for more than two people?
- The simple answer I thought of, is to calculate the EachPersonShare and then subtract it from FirstPersonSpendings and SecondPersonSpendings. Then, if the result is negative: give money back to them, if positive: Ask them for money). But I am not sure if it is an efficient way for a large group.
Cheers :-D
First of all, I am hoping that I am posting in the right place.
Second, I have a simple math problem which is used in real world and daily life. Here is the problem:
Me and my friend decided to go to a journey and split all spendings in half (EachPersonShare=TotalSpendings / 2). But the thing is, we both paid for travel charges and fees, meaning that Person1 spended $FirstPersonSpendings and person2 spended $SecondPersonSpendings and we know that $FirstPersonSpendings is not equal (!=) to $SecondPersonSpendings. EachPersonShare is easy, as TotalSpendings= FirstPersonSpendings + SecondPersonSpendings and we know that EachPersonShare = TotalSpendings / 2. But how do we split the money in one transaction that everyone pays according to their spendings (and if one of them spended more than their share, get their money back)? Can you come up with a formula? What if it is for more than two people?
- The simple answer I thought of, is to calculate the EachPersonShare and then subtract it from FirstPersonSpendings and SecondPersonSpendings. Then, if the result is negative: give money back to them, if positive: Ask them for money). But I am not sure if it is an efficient way for a large group.
Cheers :-D