bar subjected to gravity load (two segments)

the bar in the fig has constant cross sectional area A .the top half of the bar is made of material with mass density and youngs module, the bottom half of the bar made of density and young module total length of bar is 2 when bar is hung with ceiling it stretches its own weight no other loads are applied neglect gravity load on the top half of the bar