How to find the surface area of a open top rectangular container when you know the diameter and height? I'm a computer science major, and I was asked to write a program with the following question.

A manufacturer wishes to compare the cost of producing an open-top cylindrical container and an open-top rectangular container.

For the cylindrical container:


*

*The area of the base is the area of a circle = $\pi r^{2}$. 

*To calculate the area of the container's side, imagine unwrapping the side into a rectangle so the area of the side is the circle circumference times the container height.

*The circumference of a circle = $2\pi r$


For the rectangular container:


*

*The base is square, and each side is equal to the given diameter.

*To calculate the area of the container's side, you have four rectangles with length and diameter with specified height.


Write and test a program that asks for the following inputs, in order:


*

*the diameter of the base (cm)

*the height of the container (cm)

*the cost of the material ($ per square cm)

*number of containers to produce


I would just like to know what equations I would need to find the surface area of the open top rectangular container.
 A: The following is the process to find the surface area of rectangular box with its top side missing.
Let's call the side of the square base $s$ and let's call the height of the prism $h$.
Normally you have 6 sides. However, now you only have 5. 
You have 4 sides of area $hs$ and one base of area $s^{2}$.
Therefore, $SA = hs + s^{2}$.
Feel free to plug in the given values.
The following is the process to find the surface area of cylinder with its top side missing.
Let's call the diameter of the circle base $D$ and let's call the height of the prism $h$.
The lateral surface area is $\frac{D}{2} h \pi$. The area of the base is the area of a circle: $\pi r^{2}$. Adding these two expressions, the surface area is $\frac{D}{2} h \pi + \pi r^{2}$.
A: It seems they are asking you to calculate the surface area of the two containers, which don't have lids.  So, for each one you'd calculate the area of the bottom, then the area of the outer sides.  For the circular one, imagine slicing the tube down the side and unrolling it.  It would have an area of the height times the circumference of the bottom circle.  Likewise the area of the other is the area of the square bottom, plus the area of the four walls.  Here it sounds like the width of each wall is supposed to be the same as the diameter of the other container.  You've stated all the equations above, so just calculate the area of each; the cost per container would be the area times the cost of the material; and the total cost would be the cost per unit times the number of units made.
