To solve this problem it is necessary to apply the concepts related to the Force from Hooke's law, the force since Newton's second law and the potential elastic energy.
Since the forces are balanced the Spring force is equal to the force of the weight that is


Where,
k = Spring constant
x = Displacement
m = Mass
g = Gravitational Acceleration
Re-arrange to find the spring constant



Just before launch the compression is 40cm, then from Potential Elastic Energy definition



Therefore the energy stored in the spring is 63.72J