Given data
*The given mass of the ball is m = 0.400 kg
*The given height is h = 3.00 m
*The given spring constant is k = 600.0 N/m
*The value for the acceleration due to the gravity is
The expression for the spring compresses at a distance is given by the conservation of energy as
Substitute the values in the above expression as