Page 195 -
P. 195

more complex surfer data


          When data gets complex


           Hot on the heels of your success with the local surfing club, you’ve
           just been contacted by the Regional Surfing Association (RSA) and
           they want you to write a new program for them! RSA’s offering a
           brand-new, state-of-the-art, epoxy resin surf board as payment...
           once the program’s working to their satisfaction, of course.  This is too good an
          You’ve been wanting to try out an epoxy board for ages. The   offer to turn down.
           trouble is, they’re sooooo expensive and you’re a poor surfer. The
           waves will have to wait (yet again). But, the thoughts of surfing an
           epoxy board... now that’s worth waiting for.


           So what does RSA’s data look like?

           Currently, RSA’s data is stored in a text file using a proprietary
           data format. For each surfer, there’s six pieces of data recorded on   Here are the six pieces of data.
           each line in the file.
           Here’s what the data looks like:
                                                                           Competition ID.
                                                                           Name.
                 101;Johnny 'wave-boy' Jones;USA;8.32;Fish;21
                                                                           Country.
                 102;Juan Martino;Spain;9.01;Gun;36
                                                                           Average score.
                 103;Joseph 'smitty' Smyth;USA;8.85;Cruiser;18
                                                                           Preferred board type.
                 104;Stacey O'Neill;Ireland;8.91;Malibu;22
                                                                           Age.
                 105;Aideen 'board babe' Wu;Japan;8.65;Fish;24
                 106;Zack 'bonnie-lad' MacFadden;Scotland;7.82;Thruster;26
                                                                                     RSA's data is stored in
                 107;Aaron Valentino;Italy;8.98;Gun;19
                                                                                     each line, with a semicolon
                                                                                     separating each piece of data.

           RSA has tried importing this data into their favorite spreadsheet
           program, but that didn’t really work for them. RSA wants a
           program that allows them to quickly find a surfers’ data based on
           their Competition ID, then display the surfers’ details like this:


                              ID:         101
                              Name:       Johnny 'wave-boy' Jones         Each data item is displayed
             Each data item   Country:    USA                             on its own line, which makes
             is nicely labeled.   Average:    8.32                        it really easy to read (unlike

                              Board type: Fish                            the packed data file).
                              Age:        21

           160    Chapter 5
   190   191   192   193   194   195   196   197   198   199   200