In this last assignment, you will rewrite some of your code to work more concisely by using loops and control arrays. Before you start this assignment, make a copy of your fully-functional project just in case you need to restore to a working version of code.
Part 1: Add data to the tag property (2 pts.)
For each control element that deals with an item the user can purchase, use the tag property to hold the price of that item. For example, if you used checkboxes for each item, add the price of that item to the tag property of the checkbox. Do this for each checkbox. You'll use this in the next part.
Part 2: Make the Make Purchases button
work with a loop (10 pts.)
Change the code in the Make Purchases button so that it works using a loop. This loop should allow you to abandon the long list of almost-identical IF statements you used in last week's assignment, and instead get the same job done with a much shorter amount of code. To do this, you may have to rename a set of control elements so that they become a control array. Then you will be able to use a loop to check the status of each element in the array. Extra credit alert: You will get 2 extra points if you can also use a loop to display an itemized list of what the user bought.
Part 3: Do some error checking (6 pts.)
Finally, add the following functionality to your code. First, if a user presses the Play button without first selecting an artist, a dialogue box should appear that says "You must pick an artist first!" Second, if a user has selected an artist but presses Play before choosing a music clip, a dialogue box should appear that says "You must select a sound clip!" (Hint: until a user selects an item from a ListBox, its ListIndex property will hold -1.) Third, if the user did not purchase any items, instead of the Make Purchases button simply showing a total of $0, a dialogue box should appear that says "You haven't bought anything!"
These kinds of checks are called error checking routines since they are used to provide appropriate feedback should a user accidentally (or deliberately) do something unexpected.
Finally, if you couldn't get everything to work from last week's assignment, be sure to get everything working before turning this assignment in. As always, you will lose points again for any problems that remain unfixed.