When a ball falls from an initial height h, its speed s when it reaches the floo
ID: 3795474 • Letter: W
Question
When a ball falls from an initial height h, its speed s when it reaches the floor is given by the relation: s = squareroot 2 *h *g where g is the gravity constant 9.81 Immediately after hitting the floor, its speed becomes s1 = eps*s (where eps is a constant and s its speed before rebounding). The ball will then reach the height h1 = (s1)^2/(2*g) = (s*eps)/(2*g). After n rebounds, what is the equation of the height reached by the ball? Write a program (rebounding epp) that computes the height reached the ball after rebound 1, 2, ..., n rebounds. Print a statement before the height reached. Your program should define the constant g Your program should request from the user h0 (the initial height) eps (the rebound coefficient, 0Explanation / Answer
rebounding.cpp
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main()
{
float h,e;
float g = 9.8;
int n;
cout << "Enter initial height h in meters ";
cin >> h;
cout << "Enter Coefficient of restitution ";
cin >> e;
cout << "Enter number of rounds n ";
cin >> n;
int i = 1;
while(i<=n)
{
float s = sqrt(2*g*h);
h = (e*s)*(e*s)/(2*g);
cout << "After " << i << " Rebounds, height reached by ball: " << h << endl ;
i++;
}
return 0;
}
Sample Output:
Enter initial height h in meters
25
Enter Coefficient of restitution
0.9
Enter number of rounds n
10
After 1 Rebounds, height reached by ball: 20.25
After 2 Rebounds, height reached by ball: 16.4025
After 3 Rebounds, height reached by ball: 13.286
After 4 Rebounds, height reached by ball: 10.7617
After 5 Rebounds, height reached by ball: 8.71696
After 6 Rebounds, height reached by ball: 7.06074
After 7 Rebounds, height reached by ball: 5.7192
After 8 Rebounds, height reached by ball: 4.63255
After 9 Rebounds, height reached by ball: 3.75236
After 10 Rebounds, height reached by ball: 3.03942
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.