### Function Lab Programming Exercise

#### Missle Game

The distance to the landing point of a aprojectile, launched at an angle angle (in radians) with an initial velocity of velocity (in feet per second), ignoring air resistance, is given by the formula

```
velocity *  velocity * sin(2*angle)
distance    =         __________________________________

32.2

```
• Note, if you are using IE, please right click on the program, then choose save target as.
• This program ask the user to first enters the distance to target.
• The user then enters the angle and velocity for lunching a projectile.
• If the projectile comes within 0.1% of the distance to the target, the user wins the game.
• If the projectile doesn't come close enough, the user is told how far off the projectile is and is allowed to try again.
• If there isn't a winning input after five tries, then the user loses the game.
• To simplify input for the user, your program should allow the angle to be input in degrees. The formula for converting degrees to radians is
```radians = degrees * 3.14159265 / 180.0
```
• Each of the formulas in this problem should be implemented as a C++ value-returning function.

The sample output of the program should look like the following:

```Script on hercules[1]% missile

The distance to the target (in feet) must be > zero.
Enter target distance: 62.9

The launcher angle (in degrees) must be in-between zero and ninety.
Enter launcher angle: 45

The missile velocity (in feet per second) must be greater than zero.
Enter missile velocity: 45

***********************************************************
Shot Number: 1
Target Distance: 62.9
Launcher Angle: 45
Missile Velocity: 45
Missile Distance: 62.8882

The missile landed 0.0118027 feet short of the target.
***********************************************************
Hit! You win the game!
Script on hercules[2]% exit
exit

Script on hercules[1]% missile

The distance to the target (in feet) must be > zero.
Enter target distance: 0

The distance to the target (in feet) must be > zero.
Enter target distance: 62

The launcher angle (in degrees) must be in-between zero and ninety.
Enter launcher angle: 0

The launcher angle (in degrees) must be in-between zero and ninety.
Enter launcher angle: 90

The launcher angle (in degrees) must be in-between zero and ninety.
Enter launcher angle: 76

The missile velocity (in feet per second) must be greater than zero.
Enter missile velocity: -2

The missile velocity (in feet per second) must be greater than zero.
Enter missile velocity: 23

***********************************************************
Shot Number: 1
Target Distance: 62
Launcher Angle: 76
Missile Velocity: 23
Missile Distance: 7.71275

The missile landed 54.2873 feet short of the target.
***********************************************************

The launcher angle (in degrees) must be in-between zero and ninety.
Enter launcher angle: 78

The missile velocity (in feet per second) must be greater than zero.
Enter missile velocity: 43

***********************************************************
Shot Number: 2
Target Distance: 62
Launcher Angle: 78
Missile Velocity: 43
Missile Distance: 23.3558

The missile landed 38.6442 feet short of the target.
***********************************************************

The launcher angle (in degrees) must be in-between zero and ninety.
Enter launcher angle: 21

The missile velocity (in feet per second) must be greater than zero.
Enter missile velocity: 89

***********************************************************
Shot Number: 3
Target Distance: 62
Launcher Angle: 21
Missile Velocity: 89
Missile Distance: 164.602

The missile landed 102.602 feet past the target.
***********************************************************

The launcher angle (in degrees) must be in-between zero and ninety.
Enter launcher angle: 54

The missile velocity (in feet per second) must be greater than zero.
Enter missile velocity: 76

***********************************************************
Shot Number: 4
Target Distance: 62
Launcher Angle: 54
Missile Velocity: 76
Missile Distance: 170.599

The missile landed 108.599 feet past the target.
***********************************************************

The launcher angle (in degrees) must be in-between zero and ninety.
Enter launcher angle: 35

The missile velocity (in feet per second) must be greater than zero.
Enter missile velocity: 75

***********************************************************
Shot Number: 5
Target Distance: 62
Launcher Angle: 35
Missile Velocity: 75
Missile Distance: 164.154

The missile landed 102.154 feet past the target.
***********************************************************
Game Over. Play again.
Script on hercules[2]% exit

```