The coefficient of restitution of a ball, a number between 0 and 1, specifies ho
ID: 3712380 • Letter: T
Question
The coefficient of restitution of a ball, a number between 0 and 1, specifies how much energy is conserved when the ball hits a rigid surface. A coefficient of .9, for instance, means a bouncing ball will rise to 90% of its previous height after each bounce. Write a program to input a coefficient of restitution and an initial height in meters, and report how many times a ball bounces when dropped from its initial height before it rises to a height of less than 10 centimeters. Also report the total distance traveled by the ball before this point. See Fig. 3.26. The coefficients of restitution of a tennis ball, basketball, super ball, and softball are .7, .75, .9, and .3, respectively. FOR VISUAL BASIC
Explanation / Answer
The C++ code is as follows :
#include<bits/stdc++.h>
using namespace std;
#define g 9.8 // defining the gravity constant
int main()
{
cout << "Enter the coeffficient of restitution" << endl; // taking the inputs
double coefficient;
cin >> coefficient;
cout << "Enter initial height" << endl;
double height;
cin >> height;
double velocity;
int bounce = 0;
while(height >= 0.1) // checking if the height is above 10cm
{
velocity = sqrt(2 * g * height); // calculating the velocity at the bottom of the drop
velocity = coefficient * velocity; // calulating the velocity after the bounce
bounce++; // incrementing the bounce variable
height = (velocity*velocity) / (2 * g); // calculating the height to which it will bounce back
}
cout << "The number of times it will bounce till the height is not less than 10cm is " << bounce <<endl; // printing the output
return 0;
}
Output :
Enter the coeffficient of restitution
0.7
Enter initial height
1.76
The number of times it will bounce till the height is not less than 10cm is 5
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.