Question: > 
> A ball of mass $m$ is attached to a spring that is attached to a heavy moving cart (mass of cart $M >>$ mass of ball $m$) moving at velocity $V0$. The compressed spring with known spring constant $k$ is released and the ball is fired forward. The ball then strikes a similar spring with the same spring constant attached to a wall (i.e. the spring is attached to a heavy immovable object). How far does the spring attached to the wall compress?
> 
> 
> 

Is it just a matter of conservation of energy?
Ek(moving ball) + E(spring potential-for the moving spring) = E(spring potential-fixed spring)

Or does the motion of the initial spring somehow affect how much energy it can transmit to the ball. 

Or, in the frame of reference of the moving spring, can you simply calculate the velocity of the ball from E(spring potential) = Ek and add that to the initial velocity of the spring/ball and then use that new velocity to calculate the Ek and hence the energy transferred to the fixed spring and hence the compression of the spring. 

Depending on how you approach this problem you get different answers.

Answer: 
> 
> Or does the motion of the initial spring somehow affect how much energy it can transmit to the ball.
> 
> 
> 

The motion of the heavy cart must also be included in the calculation. During the launch of the ball the heavy cart is both moving and exerting a force in the direction of motion on the spring therefore work is done on the spring. So the force adds energy to the spring which is then transferred to the ball. So the total mechanical energy delivered to the receiving spring increases with increasing speed of the heavy cart. The formula that you wrote for energy is on the right track, but incomplete.
A thought experiment: you’re in a train moving at 10 m/s, and inside it there’s a 1kg object moving forward at 10 m/s with respect to the train. Inside the train, you calculate its kinetic energy to be 50 J. When it was at rest with respect to the train, an outside observer would also have given it 50 J. But now, *the outside observer calculates its energy to be 200 J* (not 50+50). You can’t add up energy like that.

A spring at rest imparts an energy of $\frac12 k x^2$ to an object, which is calculated by integrating the force over a sequence of infinitesimal distances. But when moving, the spring exerts those same forces *over longer distances*, so it does more work and imparts more energy. Again, adding up energy from the ‘inertial frame’ and from whatever happens at rest within that frame leads to the wrong result.

Thus, your intuition was wrong: you have to add up the velocities, not the energies. You may ask where the extra energy comes from (both in your experiment and in the one in the train). It comes from the vehicle, which exerts a force on one side of the spring and thus does work. If it has finite mass, it will slow down a bit and donate some of its kinetic energy to the object. If its mass is infinite, its kinetic energy also goes down by that amount – from infinity to infinity.