Previous Section  < Day Day Up >  Next Section

LAB 5: nawk EXERCISE

(Refer to the database called lab5.data on the CD.)

Mike Harrington:(510) 548-1278:250:100:175

Christian Dobbins:(408) 538-2358:155:90:201

Susan Dalsass:(206) 654-6279:250:60:50

Archie McNichol:(206) 548-1348:250:100:175

Jody Savage:(206) 548-1278:15:188:150

Guy Quigley:(916) 343-6410:250:100:175

Dan Savage:(406) 298-7744:450:300:275

Nancy McNeil:(206) 548-1278:250:80:75

John Goldenrod:(916) 348-4278:250:100:175

Chet Main:(510) 548-5258:50:95:135

Tom Savage:(408) 926-3456:250:168:200

Elizabeth Stachelin:(916) 440-1763:175:75:300

The database contains the names, phone numbers, and money contributions to the party campaign for the past three months.

Write a nawk script to produce the following output:


% nawk -f nawk.sc db



                    ***CAMPAIGN 1998 CONTRIBUTIONS***

---------------------------------------------------------------------------

NAME                 PHONE             Jan  |  Feb  |  Mar |  Total Donated

---------------------------------------------------------------------------

Mike Harrington      (510) 548-1278  250.00   100.00  175.00  525.00

Christian Dobbins    (408) 538-2358  155.00    90.00  201.00  446.00

Susan Dalsass        (206) 654-6279  250.00    60.00   50.00  360.00

Archie McNichol      (206) 548-1348  250.00   100.00  175.00  525.00

Jody Savage          (206) 548-1278   15.00   188.00  150.00  353.00

Guy Quigley          (916) 343-6410  250.00   100.00  175.00  525.00

Dan Savage           (406) 298-7744  450.00   300.00  275.00  1025.00

Nancy McNeil         (206) 548-1278  250.00    80.00   75.00  405.00

John Goldenrod       (916) 348-4278  250.00   100.00  175.00  525.00

Chet Main            (510) 548-5258   50.00    95.00  135.00  280.00

Tom Savage           (408) 926-3456  250.00    68.00  200.00  618.00

Elizabeth Stachelin  (916) 440-1763  175.00    75.00  300.00  550.00

----------------------------------------------------------------------------

                               SUMMARY

----------------------------------------------------------------------------

The campaign received a total of $6137.00 for this quarter.

The average donation for the 12 contributors was $511.42.

The highest contribution was $300.00.

The lowest contribution was $15.00.


    Previous Section  < Day Day Up >  Next Section