To develop this problem it is necessary to apply the concepts related to Work and energy conservation.
By definition we know that the work done by a particle is subject to the force and distance traveled. That is to say,

Where,
F= Force
d = Distance
On the other hand we know that the potential energy of a body is given based on height and weight, that is

The total work done would be given by the conservation and sum of these energies, that is to say

PART A) Applying the work formula,

PART B) Applying the height equation and considering that there is an angle in the distance of 25 degrees and the component we are interested in is the vertical, then



The net work would then be given by



Therefore the net work done by these 2 forces on the cannonball while it is in the cannon barrel is 3355J