In a replacement study between a defender and a challenger,

In a replacement study between a defender and a challenger, there may be a capital gain or loss when the defender asset is sold.

(a) How is the gain or loss calculated?

(b) How does it affect the AW values in the study?