A rectangular cow pasture is enclosed on three sides by a fence and the fourth side is part of the side of a barn that is 400 feet long. The fence costs $5 per foot and $1200 altogether. To the nearest foot, find the length of the side parallel to the barn that will maximize the area of the pasture.

Dividing 1200 by 5 tells us how many feet of fencing we can afford.....so ....1200 / 5 = 240 ft

Let the side of the fence paralleling the barn be x feet

Then....one of the other sides perpendicular to the barn can be represented as (240 - x) / 2

So....the area to maximize is

A = x (240 - x) / 2 simplify

A = (240x - x^2)/ 2

A = (-1/2)x^2 + 120x

The x that will maximize this is given by : -(120) / ( 2 * (-1/2) ) = 120 ft

And this is the length of the fence parallel to the barn that will max the area