Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a C++ only code, this program consists of the use of for-statements please write the complete code, and show that it runs Write a

image text in transcribed

write a C++ only code, this program consists of the use of for-statements

please write the complete code, and show that it runs

Write a program that calculates velocity, v, and distance, x, given time, t, and acceleration due to gravity, a. The program will print out f, x, and v for each time point in tabular form. The program should prompt for total time (in seconds), and step- size (in seconds) for the calculations, and print out the table of results. An example run: Enter the time, in seconds: 0.1 Enter the step-size, in seconds: o.01 t: 0.0000 sec t: 0.0100 sec t: 0.0200 sec t: 0.0300 sec t: 0.0400 sec t: 0.0500 sec t: 0.0600 sec t: 0.0700 sec t: 0.0800 sec t: 0.0900 sec t: 0.1000 sec x: 0.0000 m x: 0.0005 m x: 0.0020 m x: 0.0044 m x: 0.0078 mm x: 0.0123 nm x: 0.0177 m x: 0.0240 m x: 0.0314 m x: 0.0397 m x: 0.0490 m v: 0.0000 m/s v: 0.0981 m/s v: 0.1961 m/s v: 0.2942 m/s v: 0.3922 m/s v: 0.4903 m/s v: 0.5884 m/s v: 0.6864 m/s v: 0.7845 m/s v: 0.8825 m/s v: 0.9806 m/s The needed equations and constant are: v- ataa-accel. due to gravity 9.806 m/sec? round off the output to four decimal places (using setprecision)) the number of steps to take is rounded up for steps with fractional values separate your columns with tabs (i.e. It format escape sequence) 2 -use the ceil ( ) function to generate the number of time-steps so that - you will always start from t 0;v 0;x-0 initial conditions - declare the accel. due to gravity as a const double, above main )

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: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions