Calculating volume and wrting to text files