This is an optimization question that we can solve as follows:
Let x: width of enclosure (both sections of width cost $5/ft)
Let y: length of enclosure (one section of length costs $15/ft)
Cost = 5·2x + 5y + 15y = 10x + 20y
Constraint: xy = 320 ---> y = (320/x)
Substitute this expression in for x in the cost function to get cost as a function of x only:
C(x) = 10x + 20(320/x) = 10x + 6400/x = 10x + 6400x-1
C'(x) = 10 - 6400x-2 = 0
10x2 - 6400 = 0
x = 8√10 , y = 4√10