Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program to analyze the motion of a projectile fired from the top of a tall building. The program should satisfy the following

Write a C++ program to analyze the motion of a projectile fired from the top of a tall building.

The program should satisfy the following constraints:

The input parameters should be read in from the accompanying file ProjectileParams.txt.

The acceleration due to gravity should be a constant.

It should use appropriate pass by value functions to compute the vertical speed as well as the x and y positions. It should use a for loop.

It should create two output files (Note that all output quantities should have two decimal places of precision):

1. A file named ProjectileData.txt, which is a table with columns for time, y-position, x-position, vertical speed, and horizontal speed.

2. A file named ProjectileResults.txt which reports the following information based on your results:

The maximum height reached by the projectile.

The time for the projectile to reach maximum height.

The horizontal distance the projectile is from the building when it reaches maximum height The time for the projectile to reach the ground .

The horizontal distance from the building where the projectile hits the ground.

The speed of the projectile as it strikes the ground.

The angle (relative to the horizontal) that the projectile strikes the ground.

As you know, the motion of an object is described by the kinematic equations that you learned in your first semester of introductory physics. For two dimensional projectile motion, where the trajectory of an object is described by an upside down parabola, with constant acceleration ~a = ~g.

these equations are: x = x0 + vx0t vx = vx0 y = y0 + vy0t 1 2 gt2 vy = vy0 gt v 2 y = v 2 y0 2g (y y0) where vx0 = v0 cos vy0 = v0 sin

Use your algorithm to produce output from the given input file ProjectileParams.txt. Using your output data table, produce plots of velocity versus time and position versus time (for both x and y directions) in Microsoft Excel (or something similar) and include them in your homework write-up. Based on the equations which govern projectile motion, are these plots what you expect? Explain

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

What is an assurance engagement?

Answered: 1 week ago

Question

List and explain the four steps in the communication process.

Answered: 1 week ago

Question

1. PricewaterhouseCoopers

Answered: 1 week ago

Question

3. SCC Soft Computer

Answered: 1 week ago

Question

2. KMPG LLP

Answered: 1 week ago