This is because the calculations yield a vector dot product. Positive work is done when the applied force and the displacement act in the same direction. Negative work is done when the applied force and the displacement act in opposite directions. The positive work done can be combined with the negative work done, to determine the overall work done. Work can be determined graphically by finding the area under an applied force versus displacement graph.
Energy is the ability to do work.
When work is done, energy is transferred from one object to another. An energy transformation occurs when energy is converted from one form to another. When an energy transformation takes place, not all of the energy is used to produce useful work. Some is converted into heat or other types of energy. Maximizing efficiency during energy transformations makes the best use of the available energy.