Tom Kelliher, CS17

Mar. 13, 1996

This is due in-class on Friday, Mar. 15. You need not do it on the computer, although you are certainly free to do so.

Convert the following pseudo-code to a C++ program. (You might recognize this pseudo-code from the midterm.)

read the bounciness index
read the height
read the number of bounces

let distance = 0.0

while the number of bounces is greater than 0
   let distance = distance + height
   let height = height * bounciness index
   let distance = distance + height
   decrement by 1 the number of bounces

print the distance

Thomas P. Kelliher
Tue Mar 12 16:12:55 EST 1996
Tom Kelliher