A semicircle of radius r is inscribed in a rectangle so that the diameter of the semicircle is the length of the rectangle. See the figure.
(a) Express the area A of the rectangle as a function of the radius r of the semicircle.
(b) Express the perimeter p of the rectangle as a function of r.