Question: how to calculate the total kinetic energy before and after collision?
Answer: Initial kinetic energy KE = 1/2 m1v12 + 1/2 m2v22 = joules. The following calculation expects you to enter a final velocity for mass m1 and then it calculates the final velocity of the other mass required to conserve momentum and calculates the kinetic energy either gained or lost to make possible such a collision.