How to set related slide bars and multi-layers of slide bars



Say I first set the asset allocation for cash, bonds and stocks. Each allocation is between 0 and 1 and their sum should be 1. So I want to show 3 slide bar, one for each. I will let user choose two and the third will be automatically calculated by subtraction. How to achieve this, please?

Furthermore, for bonds, I need an additional slide bar to decide the percentage to invest in junk bonds. How to do this, please?

Is there any similar example to learn from?