### Function Lab Programming Exercise

#### Game - Flying Pumpkins

The distance to the landing point of projectile, 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 asks the user to first enter the distance to the 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 looks like the following:

```Script on hercules[1]% FlyingPumpkin

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 FlyingPumpkin velocity (in feet per second) must be greater than zero.
Enter FlyingPumpkin velocity: 45

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

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

Script on hercules[1]% FlyingPumpkin

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 FlyingPumpkin velocity (in feet per second) must be greater than zero.
Enter FlyingPumpkin velocity: -2

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

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

The FlyingPumpkin 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 FlyingPumpkin velocity (in feet per second) must be greater than zero.
Enter FlyingPumpkin velocity: 43

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

The FlyingPumpkin 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 FlyingPumpkin velocity (in feet per second) must be greater than zero.
Enter FlyingPumpkin velocity: 89

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

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

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

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

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

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

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

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

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

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

```