proj1 - Project 1: Snowball Attack Suppose it's a cold,...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Project 1: Snowball Attack Suppose it's a cold, snowy day when you're walking along Pollock Road and notice your computer science instructor standing outside the IST Building entrance talking to one of your classmates. You decide to try to hit him with a snowball. (Because you're a good student, you'd never do this. .. right?) Will you succeed? Now that you've learned several of the basic concepts of C++ programming, you can write a program that puts many of your skills to use together to predict whether or not your snowball attack will be a success. You'll have an opportunity to create a longer program where the process consists of several steps instead of just one or two and learn some important things about the flow of a program from this experience. First, let's take a moment and recall some basics of kinematics from our intro. physics experience. When you throw the snowball, it becomes a projectile and will be governed by the laws of kinematics. The snowball is thrown with some velocity, which is a vector quantity. That means it has both a magnitude and direction. We'll express the direction as an angle with respect to the horizontal. When we do computations, we need to resolve the vector quantities into components and work with the x direction separately from the y direction. Recall that we resolve a vector v at direction θ into its horizontal and vertical components using trigonometry: v x = v (cos θ) v y = v (sin θ) We can then use the equations of kinematics: 1. v f = v i + at 2. v f 2 = v i 2 + 2 ad 3. d = v i t + (1/2) at 2 where v f = final velocity v i = initial velocity a = acceleration t = time d = distance In the vertical direction, the acceleration we use is the constant acceleration due to gravity, g = -9.8 m/s 2 or g = -32 ft/s 2 . In the horizontal direction, the projectile does not experience any acceleration (which simplifies Equation #3 above for our computations). Hints:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 02/10/2011.

Page1 / 4

proj1 - Project 1: Snowball Attack Suppose it's a cold,...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online