Randomize VB Solution

Exam 2 – Programming Assignment 2
P2 is worth 45 points
For the second part of the test, you can use the zip file attached to Blackboard or create your own form. If you create
your own form, it still needs to meet the criteria listed below.
Example form:
Create a form with two buttons, one labeled “Randomize” and the other labeled “Calc Totals”.
The randomize button will perform two functions. First, it will populate a two dimensional integer array five wide and
two deep with random numbers up to 50 (hint, it is easier for the array to be a global variable). Second, it will display the
contents of the array on the form.
Example after clicking “Randomize”:
The calc totals button will also perform two functions. First, it will add the values from the rows and display them on the
form (separately). Second, it will add the values from the columns and display them on the form (again, separately).
Meaning that the first row of values will be added together and displayed on the form and the second row is added
together and displayed on the form. All five of the individual columns will also be added together and displayed on the
form. See example below based on the data above:
To receive credit for this part of the exam, the totals must be calculated by looping through the array. A for loop and a
do while loop must be used somewhere in this assignment. You could use one to populate the array and the other to
determine the totals, or one to populate and one to display the random values, etc.
If you choose to create your own form, each value must be placed on its own label. If you use nested loops, you can use
if/then or select/case statements in your logic to determine what label to use.

Powered by