Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!

# [Easy]Divide my uncle's estate!!

Arjun Shastry
Ranch Hand
Posts: 1898
1
This was asked recently by one company during test:
When my Uncle in Bombay died recently ,he left a will, instructing his executors to divide his estate of Rs. 1,920,000 in this manner:
Every son should receive three times as a daughter,and that every daughter should get twice as much as their mother
What is my aunt's share?

Timothy Chen Allen
Ranch Hand
Posts: 161
Originally posted by Capablanca Kepler:

When my Uncle in Bombay died recently ,he left a will, instructing his executors to divide his estate of Rs. 1,920,000 in this manner:
Every son should receive three times as a daughter,and that every daughter should get twice as much as their mother
What is my aunt's share?

Assuming that A is the number of sons and B is the number of daughters, and "s" is the son's share, "d" the daughter's, and "m" the mother's, the formula for the mother's share would derive as follows:
s = 3d // Son's share is 3 x daughter's
d = 2m // Mom's share is 2 x mother's
As + Bd + m = 1920000
A(6m) + B(2m) + m = 1920000
m = 1920000 / (6A + 2B + 1)
Here is a Java program to show all possible combinations between 0 and 9 sons and/or daughters (assuming only one mother!):

 Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters?