Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[Easy]Divide my uncle's estate!!

 
Arjun Shastry
Ranch Hand
Posts: 1898
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!):
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic