Calculating volume of cubes and rectangular prisms