Are you looking for the projects you need to complete at the end of the chapter? You need the Program List for Chapter 8

Chapter 8 - Arrays & Structures


Introduction to Arrays

  1. Before you begin reading this chapter, look at the Cake Flavors programs Mr. Bower has cooked up for you! These programs all run the same way as far as a user can see. Be sure to look at the code (and Mr. Bower's documentation) to see the differences among the three programs
  2. Run and look at Cake Flavors 01 (No Array). This program has nothing new. You should recognize everything in the code. Notice the need for ten variables and a Select Case block.
  3. Check out Cake Flavors 02 (With Array). This program has an array called CakeFlavors( ). While storing all ten cake flavors still takes ten lines of code, the Select Case block has been eliminated and replaced with a single line of code!
  4. And now, the frosting on the cake... Cake Flavors 03 (Load Array)! Putting the ten cake flavors into the array takes one statement in the code instead of ten!
  5. Read pages 243-244. You will recognize some of the features you tasted in the Cake Flavors program. Don't worry if you don't digest everything.
  6. Create the Student Names program outlined on pages 244-245.


Arrays with Meaningful Indexes

  1. Read pages 245-246. The main point is that you can pass an entire array to a sub or function.
  2. Read pages 246-249. Two programs are discussed in this section- Dice Rolls (slightly modified by Mr. Bower) and Letter Occurences.
  3. Modify the Dice Rolls program as described on page 249 (the original program was for two dice- you will make it work for three dice). Mr. Bower has left you some tips in the code!
    (If you haven't noticed already, scrollbars automatically appear when you have more items in a list box than can be displayed at one time).
  4. You DO NOT need to make the Number Occurences program on page 249


Dynamic Arrays

  1. Read pages 250-253. A dynamic array can change in size while a program runs. This is useful when you don't know how big the array needs to be (how many people will show up at the concert, for example).
  2. Here is the Dynamic Array Demo program from page 251.
  3. Another way to accomplish this is to use an ArrayList (not covered in your book).


Two-Dimensional Arrays

  1. Read pages 253-254 to learn about two-dimensional arrays. They are a lot like a grid. The main information is on page 253- don't worry if page 254 confuses you.
  2. Look at the Tic-Tac-Toe program to see how a two-dimensional array can be used. The code for this program appears on pages 255-256. Notice how each place on the board has a two-dimensional location [the center square is (1,1); the bottom middle square is (2,1)].



  1. Read page 257 to learn about structures. A structure allows you to group a lot of information in one variable. It is a little bit like having variables inside variables!
  2. Look at the Dog Structures program written by Mr. Bower to see an example of using a structure.
  3. Read the top of page 258 to see how an array of structures could be developed. Do you see how we could have something similar to this here with an array of over 1900 students?
  4. Look at the Dog Structures 2 program. There is a button that will allow users to see information about the dog with the longest name. Notice how a For...Next loop is used to search the entire array.
  5. Create the Customers program described in the middle of page 258.



  1. Read pages 258-259 to learn about the enumerated data type (Enum).
  2. Look at the Stratego Introduction program. Feel free to change/add to the pieces assigned to the blue and red players.
  3. Create a RockPaperScissors program that uses Enum. You can modify one of your old programs from Chapter 4 (Computer Programming I), look at pages 106-107, or start with your own idea.
  4. You do not need to create the Students program on page 260.


Case Study- Cafe Orders / Arrays of Objects

  1. Look at the Cafe Orders program. The code for this program is on pages 260-265. There is a lot going on here, so it will take you more than a couple minutes to understand how the program works.
  2. Read about arrays of objects on page 265. This is a very short, but very important, section.
  3. Look at the Month Pictures 1 program. Notice how repetitive (and long) it is. Next, check out Month Pictures 2 program to see how using arrays of objects can work.
  4. Modify the Cafe Orders program as described at the top of page 266. There is a box on page 265 that provides translations from Spanish to English.
  5. Check out the Hidden Prizes program (it is described as Exercise 13 on page 276) that Mr. Bower wrote a couple years ago. It incorporates concepts of arrays and structures you learned in this chapter.

You're ready for the Chapter 8 Program List!

Ch 08 News

This guide is now complete (except for links to the program list)!

Countdown to Pi Day!

Pi Day Countdown

Contact Mr. Bower

260.356.6104 x1121

(combine Parts 1 and 2 with the "@" symbol)
Part 1: sbower
Part 2: