Optimization: Finding Volume of a cubic rectangle. 
Question: According to postal regulations, a carton is classified as "oversized" if the sum of its height and girth (the perimeter of its base) exceeds 118 in. Find the dimensions of a carton with square base that is not oversized and has maximum volume.

Attempt: Since the base is a square,its perimeter would be $4s$ ($s =$ one side). So $h+4s=118$.
Solving for $h$, $h= 118 - 4s$.
The volume is $V = L \times W \times h$, and length and width are the same since the base is a square. So
$$V = 2s x h.$$
Substitute for $h$, $V = 2s(118-4s)$; $v = 236s-8s^2$.
Derivative of $V = 236-16s$.
Critical point at $s = 236/16 = 14.75$, which must be a max.
So length of a side is $14.75in.$, and height would be $59in.$, but its coming up as wrong. Any help would be appreciated.

The volume of such a container is:
$$V= s^2h$$
Where V is volume, s is one side of the square base, and h is the height. Obviously the maximum volume  will use the maximum side lengths, so we have:
$$4s+h = 118$$ 
$$h = 118-4s$$
We want the volume equation to be in terms of just one variable, so we plug in the new value of h:
$$V= s^2(118-4s) = 118s^2 -4s^3 $$
Take the derivative:
$$V'= 236s-12s^2 $$
And optimize:
$$0= 236s -12s^2=236-12s$$ 
$$s=236/12 = 59/3 $$
Solving for h gives the ideal dimensions at: 59/3" x 59/3" x 118/3"
