C++ homework ( visual studio )

User Generated

u_nyxnaqrevv

Programming

Description

When a ball falls from an initial height h, its speed s when it reaches the floor is given by the relation: 𝑠 = √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 = (𝑠1)2 /(2 ∗ 𝑔) = (𝑠 ∗ 𝑒𝑝𝑠)2 /(2 ∗ 𝑔). After n rebounds, what is the equation of the height reached by the ball?

Write a program (rebounding.cpp) 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, 0< eps <1)
  • - n (the number of rebounds, 0<= n) For h0 = 25, eps = 0.9, and n = 10, the height obtained should be around 3.04

 To use sqrt() function you will need to #include <cmath>

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

This is the progra...


Anonymous
Great! 10/10 would recommend using Studypool to help you study.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags