What is a good diet and exercise program for a person to gain weight?

Resistance! Avoid extreme cardio, but do some. Weight training is necessary to add muscle quickly. Remember, you want muscle, not fat. Get high amounts of protein inside you: 1gram per lb of weight. Avoid useless carbs.
Why? Except for chronically ill persons or very small babies, weight gain is rarely medically indicated. For athletics, weight gain should come through conditioning, including resistance (weight) training and a diet rich in lean proteins- I usually advise fish, eggs, legumes etc over supplements. Like weight loss, healthy weight gain is slow and high saturated fat or high-sugar foods should be avoided.