Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C program to simulate a falling object . The program should ask for the

ID: 3808272 • Letter: W

Question

Write a C program to simulate a falling object. The program should ask for the initial height of the object, in feet. The output of the program should be the time for the object to fall to the ground, and the impact velocity, in ft/s and miles/hour.
Your program should use Euler’s method to numerically solve the differential equations describing the motion of a falling object. In Euler’s method, the state of the object at some small future time is calculated using the values at the present time. This small future timestep is typically called delta time, or dt. Thus the position (p) and speed (v) of the object in the next timestep t + dt is written as a simple function of the position and speed at the current timestep t (g is the acceleration due to gravity):
v(t+dt) = v(t) + g * dt

p(t+dt) = p(t) + v(t+dt) * dt
You should actually start out with the velocity as zero, and the position at the initial height of the object. Then your position (above the ground) would be:
p(t+dt) = p(t) - v(t+dt) * dt
And you would integrate until the position becomes less than or equal to zero.
The input/output formats for your program should look like this:
Program to calculate fall time and impact speed of a falling object dropped from a specific height. Enter initial height in feet: 100

Falling time = 2.492224 seconds Impact speed = 80.249613 feet/sec Impact speed = 54.715645 mph

Part of this assignment is to determine an optimum value for dt.   Clearly, the value of the time step that you use in the simulation will be important. If the timestep (dt) is too large, then the results will not be accurate. However, if the time step is too small, then the program run time
will be excessive. For this assignment, you must determine the value of delta time that is as large as possible but at the same time, results in an answer that is accurate to 5 significant figures – i.e., further decreases in the time step no longer change the result past the 5th digit to the right of the decimal place. Turn in your program configured with this value of dt.
Accuracy and precision is important for this assignment. You should use a double float data type for all real numbers. Also assume the effect of gravity does not vary with distance from the earth, the rate of acceleration is 32.2 feet per second per second, and the resistance of passing through the atmosphere is non-existent.
Using symbolic constants for gravity G = 32.2 and delta time DT = .000??????? makes sense.

Explanation / Answer

Answer:

in first question initial height is given and intial speed is given and the time take to fallen on ground and impact velocity is asked

first equation of motion is v=u +gdt

u=0 intial velocity is given in question is zero

g is 32.2 in feet/s^2

all three equations of motion are v=u +gdt ......................(1)

v^2=u^2+2gh........................(2)

and

h=udt+1/2gdt^2..................(3) where dt is the time interval ,h is distance covered,v is final velocity and u is initial velocity,g is gravitational acceleration.

form equation 2 .

v=square rootof 2gh

initial height is given is 100feet.

so v=sqrt(2gh) this is basic concept of program i going to write.

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

void time1(double h){
double v,t;
v=sqrt(2*32.2*h);

t=v/32.2;
cout<<"Faliing time"<<":";
cout<<t<<" sec"<<endl;
cout<<"Impact speed in feet per sec"<<":";
cout<<v<<" feet/sec"<<endl;
double v1=v*0.681818;
cout<<"Impact speed in mph"<<":";
cout<<v1<<" mph"<<endl;
}   
int main(){
double h;
cin>>h;
time1(h);

return 0;
}

output:

Input (stdin)

Your Output

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote