Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Newtons laws of motion predict the (x, y) position of an object at time T, with an initial velocity V (in ft/sec) and initial angle

Newtons laws of motion predict the (x, y) position of an object at time T, with an initial velocity V (in ft/sec) and initial angle of movement A(in degrees). Ignoring friction, the equations are
x = cos(A)VT
y = sin(A)VT - (1/2)gT^2
where g denotes the acceleration due to gravity; assume the constant g = 32.174 ft/sec^2. For example, an American football thrown at an angle A of 40 degrees, with an initial velocity V of 88 ft/sec, is at position (134.824, 48.7825) when time T = 2 seconds. On an American football field, that's about 45 yards down the field, and 16 yards up in the air.
Write a complete C++ program that inputs three values: the initial velocity V in ft/sec (a real number), the angle A in degrees (a real number), and the timestep (a real number), in this order. The program then computes the (x, y) position of the object at every timestep, starting at 0.0 seconds and stopping after 5.0 seconds. For example, suppose the inputs are the following angle and initial velocity
88.0
40.0
0.5
Your program should output the following values, where each line denotes the time T followed by the object's (x, y) position at T:
0: (0, 0)
0.5: (33.706, 24.2609)
1: (67.4119, 40.4783)
1.5: (101.118, 48.6522)
2: (134.824, 48.7825)
2.5: (168.53, 40.8694)
3: (202.236, 24.9128)
3.5: (235.942, 0.912695)
4: (269.648, -31.1309)
4.5: (303.354, -71.218)
5: (337.06, -119.349)
Note that C++ provides built-in cosine and sine functions, cos(R) and sin(R). However, these functions work in radians (not degrees), so you'll need to convert A to radians using R = A * PI / 180; define PI=3.14159. You'll also need to include the header file to gain access to the cos(R) and sin(R) functions.
Assume all input values are valid, i.e. are positive real numbers.
image text in transcribed
image text in transcribed
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions

Question

The company has fair promotion/advancement policies.

Answered: 1 week ago