Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Asking for the C++ Code With the football season coming to an end, program to simulate kicking a field goal. First, let's take a moment

Asking for the C++ Code

With the football season coming to an end, program to simulate kicking a field goal.

First, let's take a moment and recall some basics of kinematics from our intro. physics experience. I am assuming you've all taken introductory physics and trig. When you kick the ball, it becomes a projectile and will be governed by the laws of kinematics. The ball is kicked 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:

  • vx = v (cos )
  • vy = v (sin )

We can then use the equations of kinematics:

  1. vf = vi + at
  2. vf2 = vi2 + 2ad
  3. d = vit + (1/2)at2

where

  • vf = final velocity
  • vi = initial velocity
  • a = acceleration
  • t = time
  • d = distance

In the vertical direction, the acceleration we use is the constant acceleration due to gravity, g = -32 ft/s2. In the horizontal direction, the projectile does not experience any acceleration (which simplifies Equation #3 above for our computations).

Simulation

Inputs from the user:

  • The magnitude of the velocity with which the ball was kicked, in ft/s
  • The angle with respect to the horizontal of the velocity vector, in degrees
  • The horizontal distance field goal that you are trying to kick, in yards
  • Don't forget to convert to feet

Assume:

  • The field goal post has a cross bar 10 feet tall, that means the ball has to pass over 10 feet to be a good field goal. Make sure the user knows this information to scale the height of the structure accordingly.
  • We are assuming the kicker is perfect and kicks it straight every time, i.e. you don't need to worry about the kick going to the left or the right.
  • There is no air resistance/wind resistance that we must take into account, i.e. the "ignore friction and air resistance" clause that's standard in most introductory physics books applies here.

compute and output:

  1. The time it takes for the ball to reach the field goal posts.
  2. The magnitude and direction of the velocity when the ball reaches the target distance.
  3. The height of the ball when it reaches the target distance.
  4. Whether it was a good field goal or if the kick is too short.
  5. If the field goal is good, how far past the post did it land?

Bonus: Output if the ball hits the post (assume post is 6 inches in circumference).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions