The spring is unstretched at the position x = 0. Under the action of a force P, the card moves from the initial position x1 = -6 in. to the final position x2 = 3 in. Determine (a) the work done on the cart by the spring and (b) the work done on the cart by its weight