Web design seattle - Chapter 7 Arrays 247 96 97 } //

Chapter 7 Arrays 247 96 97 } // end class RollDie Results after one roll Results after fifty rolls Fig. 7.6 Using arrays to eliminate a switch structure. (Part 3 of 3.) 7.4.5 Using Arrays to Analyze Survey Results Our next example uses arrays to summarize the results of data collected in a survey. Consider the following problem statement: Forty students were asked to rate the quality of the food in the student cafeteria on a scale of 1 to 10, with 1 being awful and 10 being excellent. Place the 40 responses in an integer array and summarize the frequency for each rating. This is a typical array processing application (Fig. 7.7). We wish to summarize the number of responses of each type (i.e., 1 10). The array responses is a 40-element integer array of the students responses to the survey. We use an 11-element array frequency to count the number of occurrences of each response. We ignore the first element, frequency[0], because it is more logical to have a response of 1 increment frequency[1] than frequency[0]. We can use each response directly as a subscript on the frequencyarray. Each element of the array is used as a counter for one of the survey responses.
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

Leave a Reply