If you only have 40 feet of fence, the perimeter has to be less than or equal to 40 feet.
Depending on the shape of your area, you could have any number of answers for your area. I'm not going to take the time to prove it here, but it is true that the maximum area bounded by a given perimeter is when the shape is symmetrical. That is, for a given perimeter the maximum area quadrilateral is a square. For your 40 foot perimeter, that would be a square 10 feet on a side with an area of 100 square feet.
It is also true that the area bounded by a given perimeter increases as the number of sides of the bounded polygon increase -- with the limit being the circle. Hence, for a 40 foot circumference (read perimeter) the largest area that can be bounded is a circle with radius and therefore area of square feet.
If you aren't particularly looking for the maximum area possible, then all bets are off and you need to provide more information about what you are trying to accomplish.
John
My calculator said it, I believe it, that settles it