Question

In: Computer Science

Using C++, write a program to calculate the height and velocity of a ball thrown upward...

Using C++, write a program to calculate the height and velocity of a ball thrown upward at a user-specified height and speed in 10 seconds. Position (h) and velocity (v) of the ball as a function of time are given by the equations: h(t) =(1/2)gt2 + v0t + h0 v(t) = gt + v0

Solutions

Expert Solution

#include<iostream>
using namespace std;
int main()
{
    int t=10;
    float height,velocity,f_height,f_velocity,g=9.8;
    cout<<"Enter the height(in meters): ";
    cin>>height;
    cout<<"Enter the velocity: ";
    cin>>velocity;
    f_height=(0.5)*g*(t*t)+velocity*t+height;
    f_velocity=g*t+velocity;
    cout<<"The height and the velocity of the ball thrown upwards "<<height<<"m high and with a speed of "<<velocity<<"m/s is "<<f_height<<"m and "<<f_velocity<<"m/s";
}

The program in c++ will asks the suer to enter the height and then enter the velocity and then as we know gravitational accreleration is 9.8 and time is given as 10seconds and then we calculathe the f_height and f_velocity as per the following formuale and then we print the message with the calculated height and velocity.

SCREENSHOT OF THE OUTPUT :


Related Solutions

A ball is thrown vertically upward from a height of 5 ft with an initial velocity...
A ball is thrown vertically upward from a height of 5 ft with an initial velocity of 40 feet per second. Note that the acceleration of the ball is given by a(t) = −32 m/s2. How high will the ball go? When does the ball hit the ground? What is the velocity of the ball when it hits the ground?
A ball is thrown vertically upward a returns to the same height in 5.37 s.   A...
A ball is thrown vertically upward a returns to the same height in 5.37 s.   A second ball is thrown at 37 degrees . What speed must the second ball have to reach the same height as the first ball?
A ball of mass 75g is thrown upward with an initial positive velocity, vi, at position...
A ball of mass 75g is thrown upward with an initial positive velocity, vi, at position A.   Match the energy transformations taking place for each region of the ball's motion. Question 23 options: Moving from Position C (before hitting the ground) to stopped after hitting the ground Position B to Position C    Position A to Position B 1. K → Ug 2. Ug → K 3. K → Eth 4. Ug → Eth
A ball is thrown upward with initial velocity v0 = 15.0 m/s at an angle of...
A ball is thrown upward with initial velocity v0 = 15.0 m/s at an angle of 30° with the horizontal. The thrower stands near the top of a Jong hill which slopes downward at an angle of 20°. Determine how far down the slope the ball strikes.
•A ball is thrown upward from an initial height of   4.9 m with an initial speed...
•A ball is thrown upward from an initial height of   4.9 m with an initial speed of 9.8 m/s •How high is the ball 2.0 s later? •What is the velocity of the ball at its highest point •When does it reach Its highest point •How high does the ball go? •When does the ball hit the ground? •How fast is it going when (right before) it hits the ground?
Two identical balls, Ball A and Ball B are thrown vertically upward. Ball A is thrown...
Two identical balls, Ball A and Ball B are thrown vertically upward. Ball A is thrown with an initial speed of v, and Ball B is thrown with an initial speed of 2v. Which of the following statement is correct? Ignore air resistance. A. The maximum heights of the two balls are equal. B. The maximum height of the second ball is eight times that of the first ball. C. The maximum height of the second ball is 1.41 times...
An object is thrown vertically upward with an initial velocity of 10 m/sec from a height...
An object is thrown vertically upward with an initial velocity of 10 m/sec from a height of 3 meters. In meters, find the highest point it reaches. (Round your answer to three decimal places, in m) Find when it hits the ground. (Enter your answer in seconds. Round your answer to three decimal places in seconds)
A blue ball is thrown upward with an initial speed of 24.3 m/s, from a height...
A blue ball is thrown upward with an initial speed of 24.3 m/s, from a height of 0.9 meters above the ground. 3 seconds after the blue ball is thrown, a red ball is thrown down with an initial speed of 8.2 m/s from a height of 33.3 meters above the ground. The force of gravity due to the earth results in the balls each having a constant downward acceleration of 9.81 m/s2. 4) What is the height of the...
A blue ball is thrown upward with an initial speed of 22.2 m/s, from a height...
A blue ball is thrown upward with an initial speed of 22.2 m/s, from a height of 0.5 meters above the ground. 2.7 seconds after the blue ball is thrown, a red ball is thrown down with an initial speed of 10.7 m/s from a height of 26.9 meters above the ground. The force of gravity due to the earth results in the balls each having a constant downward acceleration of 9.81 m/s2 a. What is the height of the...
Ball Thrown upward with an initial speed of 14.7m/s from a height of 89m a)Draw the...
Ball Thrown upward with an initial speed of 14.7m/s from a height of 89m a)Draw the sketch of this motion b) State the theory that describes this motion c) Write the velocity and position kinematics equations with the number obtained from the sketch d) Solve all unknowns - Final velocity - How long it takes that ball hit the ground - Maximum Height - Acceleration (I think its gravity) e) Draw the velocity vs time and position vs time graphs
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT