Projectile Motion
From Hack Wars Wiki
Outdated, should be deleted. - aoi
| Challenge Information for Projectile Motion | |
| Challenge | Projectile Motion |
| Code | 16 |
| Input Example | 70.0, 9.8 (Double) |
| Output Example | 6.2993164 (Double) |
| Level | 0 |
| Profit | $0 |
| Experience | 0 to each stat |
| Description | Given a launch angle (degrees) and intial speed (m/s), determine how far a projectile will go. Gravity is 9.8 m/s^2 |
Solution
float angle = getInputFloat(); float speed = getInputFloat(); float vspeed = sin(angle) * speed; float time = 2 * vspeed / 9.8; float hspeed = cos(angle) * speed; float disttrav = hspeed * time; setOutputFloat(disttrav); |
