Write a C++ program that allows the user to enter the percentage of the moon’s face that appears illuminated, and that outputs the surface area of that portion of the moon. The formula for the surface area of a segment of a sphere is
where R is the radius of the sphere (the moon’s radius is 1738.3 km) and u is the angle of the wedge in radians. There are 2π radians in a circle, so the hemisphere of the moon that we see accounts for at most π radians. Thus, if the user enters 100% (full moon), the angle of the wedge is π and the formula can be evaluated as follows:
If the user enters 50% (first or last quarter), then the angle of the wedge is π × 3 0.5, and so on. Be sure to use proper formatting and appropriate comments in your code. Provide appropriate prompts to the user. The output should be labeled clearly and formatted neatly (limit the decimal precision to three places as in the example above).
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.