Program 2: The bouncing Ball

The problem is exercise 17, on page 258 of your textbook. Follow these steps to get a successful program. Note that steps 1 to 6 are best done away from the computer.

  1. Read the description of exercise 17 on page 258 and write a one sentence problem statement.
  2. Write a short paragraph as a problem description that contains only relevant information. This will come from the description in the book, but can be reworked to leave out parts that will not end up in your program.
  3. Analyze the description and draw a top-down stepwise refinement diagram that has at least three levels in it. Choose brief descriptions for each of the boxes in the diagram that can end up as names you use in your program source code. Don't forget to make at least two boxes as the breakdown of each box which you refine.
  4. Take the structure of the diagram and translate it directly into the structure of your Pascal program, i.e. write a skelton program with procedure declarations only. You must use as many procedures as there are boxes in the diagram, except for the top-most box which corresponds to the program itself, or the lowest level boxes which may translate directly into Pascal statements.
  5. Choose appropriate variables that can be declared as global and passed selectively to the procedures as needed. Choose the type of the variables carefully, and only use VAR parameters where you intend a procedure to pass a value back out.
  6. Complete the source code with correct Pascal syntax, and appropriate comments that come straight from your top-down analysis.
  7. Type the source code into the Turbo Pascal editor, compile the program and run it with the data listed in the box to the left of exercise 7.
  8. You may need to change the program to get it to compile and run successfully. This is normal. However, if your changes turn out to be major you should revise your design document so that the design and the program code are in sync at all times.
  9. Print the source code and the output screen form running your program, and turn in these two printouts, and your design document on Monday, October 28th, by 5pm.