calculate the average cost of stocks (C#)