Konrad
Dzwonkiewicz
C++
Program
23
Program 23: The Super Happy Fun Ball
Using a while loop that is event controlled:
This program will simulate a super happy fun ball being dropped and
measuring its super happy fun bounces.
The said super
happy fun ball is dropped from the roof of a super happy fun building. It drops 16 feet to the super happy fun
ground. When it bounces back up only by
a super happy fun factor of .81 (.81*16=12.96) and bounces back to the super
happy fun height of 12.96 feet.
Eventually it will stop bouncing, and this will be defined as a .01ft or
less super happy fun bounce height. To
control this absolute super happy fun craziness with the while loop you need to
use, you can have the super happy fun while loop look like this:
while(up>.01){

Sample
run’s output:
Enter starting
distance of super happy fun ball (in feet) ___ 16
SUPER HAPPY FUN BOUNCE REPORT:
First travel is
16.00ft. then First Bounce
Bounce #1: Rebounds
12.9600ft. Drops back down 12.9600ft.
Bounce #2: Rebounds
10.4976ft. Drops back down 10.4976ft.
Bounce #3: Rebounds
8.5031ft. Drops back down 8.5031ft.
Bounce #4: Rebounds
6.8875ft. Drops back down 6.8875ft.
Bounce #5: Rebounds
5.5789ft. Drops back down 5.5789ft.
Bounce #6: Rebounds
4.5189ft. Drops back down 4.5189ft.
Bounce #7: Rebounds
3.6603ft. Drops back down 3.6603ft.
Bounce #8: Rebounds
2.9648ft. Drops back down 2.9648ft.
Bounce #9: Rebounds
2.4015ft. Drops back down 2.4015ft.
Bounce #10: Rebounds
1.9452ft. Drops back down 1.9452ft.
Bounce #11: Rebounds
1.5756ft. Drops back down 1.5756ft.
Bounce #12: Rebounds
1.2763ft. Drops back down 1.2763ft.
Bounce #13: Rebounds
1.0338ft. Drops back down 1.0338ft.
Bounce #14: Rebounds
0.8374ft. Drops back down 0.8374ft.
Bounce #15: Rebounds
0.6783ft. Drops back down 0.6783ft.
Bounce #16: Rebounds
0.5494ft. Drops back down 0.5494ft.
Bounce #17: Rebounds
0.4450ft. Drops back down 0.4450ft.
Bounce #18: Rebounds
0.3605ft. Drops back down 0.3605ft.
Bounce #19: Rebounds
0.2920ft. Drops back down 0.2920ft.
Bounce #20: Rebounds
0.2365ft. Drops back down 0.2365ft.
Bounce #21: Rebounds
0.1916ft. Drops back down 0.1916ft.
Bounce #22: Rebounds
0.1552ft. Drops back down 0.1552ft.
Bounce #23: Rebounds
0.1257ft. Drops back down 0.1257ft.
Bounce #24: Rebounds
0.1018ft. Drops back down 0.1018ft.
Bounce #25: Rebounds
0.0825ft. Drops back down 0.0825ft.
Bounce #26: Rebounds
0.0668ft. Drops back down 0.0668ft.
Bounce #27: Rebounds
0.0541ft. Drops back down 0.0541ft.
Bounce #28: Rebounds
0.0438ft. Drops back down 0.0438ft.
Bounce #29: Rebounds
0.0355ft. Drops back down 0.0355ft.
Bounce #30: Rebounds
0.0288ft. Drops back down 0.0288ft.
Bounce #31: Rebounds
0.0233ft. Drops back down 0.0233ft.
Bounce #32: Rebounds
0.0189ft. Drops back down 0.0189ft.
Bounce #33: Rebounds
0.0153ft. Drops back down 0.0153ft.
Bounce #34: Rebounds
0.0124ft. Drops back down 0.0124ft.
Bounce #35: Rebounds
0.0100ft. Drops back down 0.0100ft.
Bounce #36: Rebounds
0.0081ft. Drops back down 0.0081ft.
It took 36
negligable bounces before the negligable distance of .01
It travelled
152.4211 super happy fun feet including the first fall.
Have a super happy
fun day.