Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Programming I Module 13.2.1. This lesson illustrates how to code for arrays used to store data and how to display your data in listboxes.

Similar presentations


Presentation on theme: "Computer Programming I Module 13.2.1. This lesson illustrates how to code for arrays used to store data and how to display your data in listboxes."— Presentation transcript:

1 Computer Programming I Module 13.2.1

2 This lesson illustrates how to code for arrays used to store data and how to display your data in listboxes.

3 Often, arrays are used to store data. Please review the following code: This program calculates the number of times the roll of a die generates a particular value. Out of 10,000 rolls, one die will have roughly equal outcomes for each number of 1 to 6.

4 The code statements keep track of the frequency of times each number is rolled by the following code:

5 Thus, each time the dice are rolled, the element in each index is increased by one. The following code displays the number of times each outcome is rolled:

6  Interestingly enough, no matter how many sets of times you roll 10,000 times, the percentages will always remain relatively constant. Why is this? Well, it has to do with odds and percentages.  The code in the previous tab is just one example of how arrays are used in programs to store data. What would happen to the percentages if a pair of dice were thrown instead of just one? In an upcoming assignment, you will get the opportunity to find out!

7 List Boxes are used to display a list of items. In the previous example with the dice, the form has a List Box which shows the following information:

8  This will display the elements created. Some of the more useful properties of a List Box:

9  List Boxes also have methods that can be used by the programmer to accomplish certain tasks. Here are some of the more useful methods:

10 Click the box below and view the following video demonstration about Arrays and List Boxes.

11 Now, it is time for you to demonstrate your understanding of arrays and listboxes. Move on to 13.2.2 Arrays and Listboxes Assignment.13.2.2 Arrays and Listboxes Assignment


Download ppt "Computer Programming I Module 13.2.1. This lesson illustrates how to code for arrays used to store data and how to display your data in listboxes."

Similar presentations


Ads by Google