Prg211-Array Structures

Only available on StudyMode
  • Download(s) : 92
  • Published : September 30, 2012
Open Document
Text Preview
Array Structure
PRG 211
January 11, 2012
University of Phoenix

Array Structure
The purpose of the parallel array structure is to hold 2 different elements of information on budget numbers for each month. I created two parallel arrays one to hold the budget scheduled amount and another array to hold the budgeted amount that was achieved. Each array will hold information for each month. If I created this by using inputs without arrays, I would have had to create 24 different input statements to hold the 24 different elements of information. Using the array was much each and quicker. I just needed to create a loop with an end value of 12, which represented the 12 months of the year. Each pass through the loop, the month would change and I was able to enter both the scheduled budgeted information and the achieved budget. Once the loop was completed, the array was filled with information. In order to output the information, I created a second for loop to be able to output each month has moved through the second loop. I was able to do this by creating three if decision trees that determined whether the budgeted quota was equal, over, or under budget, then i output the information to the console for each time through the loop. I used the console instead of the screen to be able to output more than 1 line for each loop. This way it shows all 12 months of data for both budgets arrays in one Output window. If I would have done this without using arrays and loops, I would have had to create 3 decision trees with 3 outputs for each of the 12 months which would have taken much more time and more likely to make a mistake. In conclusion I would state that by using arrays, it makes it much easier to store and retrieve information into the different elements of the array.

Here is a copy of the pseudocode that I will be using to create the program. //Make Array BudgetQuota to hold 12 months of the scheduled budget quota Make Array (BudetQuota,12)
//Make...
tracking img