CS 101 Laboratory Programming Assignment Four

More Balloon Design

Your millionaire adventurer friend is very pleased with your help in balloon design. So much so that he has a request. He wants you to enhance your balloon program to produce an on-screen table of sausage balloon payloads.

The six columns of the table should have the payloads for the sausage diameters 20, 22, 24, 26, 28, and 30 feet, and the eleven rows of the table should have the payloads for the sausage lengths of 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, and 50 feet.

You should add a menu option for producing this table with column headers and row labels. Turn in the usual source code and output sample.

Lab 4 can be based on lab 3 (it's easier that way). You just need to add some code into your old program for lab 3. In addtion to the different menu options to calculate payload or diameter/length for those two kinds of balloon designs in lab 3, you need to add one more menu option: displaying a table. This table will show 66 different payloads of a sausage ballon based on the numbers specified in the description.

The on-screen table should have column headers and row labels (numbers to represent length and diameter).

The table should look something like this:

       20      22      24      26      28      30

30     361     726     894     964     636     708
32     492     765     840     918     698     780
34     524     703     886     972     761     852
36     655     741     832     926     824     924
38     687     779     877     980     887     997
40     618     718     823     934     949    1069
42     650     756     869     988    1012    1141
44     681     794     815     942    1075    1213
46     613     732     860     995    1137    1285
48     644     771     806     949    1200    1357
50     675     709     852     903    1263    1429

Solution

Here is the instructor's example which, of course, is but one of a nearly infinite number of ways to produce this program. Functions are re-used where possible (sausagePayload() and iterativeSearch(), for example) and a consistent variable naming convention is utilized.



This page established February 8, 1999; last updated March 2, 1999 by Rick Wagner.