ALGORITHMS AND LOGIC FOR COMPUTER PROGRAMMING
September 18, 2013
University of Phoenix Material
Parallel array structures are multiple arrays acting as one. In the regional drug company the purpose of the parallel array structure is to hold two different elements of information; one is the generic or brand name sold, and the second is the amount sold. These elements are linked to each other to describe a particular concept.
Each array will hold information for 15 days. If I created this by using inputs without arrays, I would have had to create 30 different input statements to hold the 30 different elements of information. Using the array is much easier and quicker. According to Stewart Venit and Elizabeth Drake book (2011) Prelude to programming 5e “array help create more efficient programs. Once data are entered into an array, data that can be processed many times without having to be input again” I just need to create a loop with an end value of 15, which represented the days the data collected. Each pass through the loop, the day would change and I would be able to enter both the generic name and the amount sold. Once the loop was completed, the array was filled with information.
In order to output the information, I would create a second FOR loop to be able to output each day moved through the second loop. I would be able to do this by creating three IF decision trees that determined whether the name is generic or brand name, and amount sold. Then I output the information to the console for each time through the loop. I would use the console instead of the screen to be able to output more than 1 line for each loop. This way it shows all 15 days of data weather generic or brand names and amount 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 day of the 15 days which would...
Please join StudyMode to read the full document