urgent program to to calculating

Write your question here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Hi Gays 
I want help to write my program
The formula for the surface area of a lune is S = 2 * r2 * θ
    	    r is the radius of the sphere and
                θ is the angle of the wedge in radians




Now we need to do some math to get the wedge angle:

There are 2 π radians in a circle, so the hemisphere of the moon that we see accounts for at most π radians.  Therefore, if the user enters that 100% of the face of the planet or moon is visible, the angle θ is 1.0 * π.  If the user enters 50%, the angle is 0.5 * π, etc.
Write a program that begins by displaying your course header (see above) and a brief description of the program.  
Open a do-while or while loop.  Ask the user for his/her name.  You will need to display a menu of the planets and the moon so that you can ask the user to select a planet or the moon.  Then ask for the percentage of the face that is illuminated.  
Validate the user’s answer by checking that the percentage entered is greater than or equal to 0 and less than or equal to 100.  If the input is not in range, tell the user that the number entered is not in range.  If it is in range, continue to calculate the lune and display the answer. 
Use vectors to hold planet names and their respective radii. The menu for selecting the planet should provide an easy way to reference the selected planet’s data. 

There are five planets and the moon that can be seen from earth with the unaided eye:
		Name	         Radius (km)
1.	Mercury	2440 
2.	Mars		3397
3.	Venus		6052 
4.	Saturn		60,268
5.	Jupiter		71,492
6.	Moon		1738

 Once you know the planet, you will know r, and when you know the percentage of the hemisphere that is illuminated, you will be able to calculate θ.  So now you can calculate the surface area of the lune.  
Format your output to have 3 decimal places.  Be sure to include the units where they are appropriate.
Display the information to the user:  their name, the planet chosen, the percent of the face that was illuminated, the radius of the planet, and the surface are of the lune.   
Ask if he/she wants to calculate another lune.  If yes, loop up to the top of the play loop.  If not, write a good-bye message to the user.

Your program should have only one set of result-variables.  The calculations should be performed in only one place in your program.  Do not duplicate the calculation and output code for each planet.  Make your program as efficient as possible without losing clarity.

 
  Put the code you need help with here.
People won't do your homework for you. Show what you've tried and what didn't work. We can help you figure out and understand what you are having problems with then.
Topic archived. No new replies allowed.