title: Bouncing ball: number of bounces and tracelled distance
body: <p>I have received an interesting javascript practice exercise that I'm trying to understand. The problem below (screenshot) needs to be solved with a while loop.</p>
  
  <blockquote>
    <p>The <em>coefficient of restitution</em> of a ball, a number between 0 and 1, specifies how much energy is conserved when a 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. </p>
    
    <p>Write a program to input a coefficient of restitution and an initial hight 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.  </p>
    
    <p>The coefficients of restitution for a tennis ball, basketball, super ball, and softball are .7, .75, .9, and .3, respectively. </p>
  </blockquote>
  
  <p>I'm trying to use the code below to complete this, but it simply hangs. </p>
  
  <pre><code> function code1() {
    var heightM = getInputOne();
    var heightCm = heightM * 100;
    var coefficient = getInputTwo();
    var distance = getInputOne();
    var bounce = 0;
  
    while (heightCm &gt;= 10) {
      bounce = bounce + 1;
      distance = distance + (heightM * coefficient * 2);
      heightCm = heightCm * coefficient;
    }
    console.log(bounce);
    console.log(distance);
  
  }
  </code></pre>
  
  <p>Here are the functions being called within it</p>
  
  <pre><code>// Return the text in the 'In 1:' box
  function getInputOne() {
    var input = getElement("inOne");
    return input.value;
  }
  
  // Return the text in the 'In 2:' box
  function getInputTwo() {
    var input = getElement("inTwo");
    return input.value;
  }
  </code></pre>
  
  <p>Any help with this would be appreciated. Also, let me know what other data might be useful.</p>