Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Lab 7.2 - Checking the Work Using the program from Lab 9.1, complete the follorw

ID: 3601926 • Letter: L

Question

Lab 7.2 - Checking the Work Using the program from Lab 9.1, complete the follorwing checks for a better understanding of your work. Step 1: Imagine the following mmber of pints were entered into the array. Step 2: Recall Step 5 of Lab 7.1 that accumulates the pints collected. Declare Integer counter = 0 For ccunter0 to End Fo:r Set totalPant totalPanes + pints [counter] Step 3: Complete the following chart by writing what the counter and the totalPints value stores on each iteration of the loop. ounter 34 Step 4: Recall Step 9 from Lab 7.1 that determines the high value. Set highPints int1101 set index = 1 For index 1 to 6 If pints [index] > highPints Then Set high?ints = pints [index] End If End Fo:r Step 5: Complete the following chart by writing what the highPints and the pints array value stores on each iteration of the loop. Also conclude whether it will be True or False. rue or False TRUE FALSE

Explanation / Answer

pints array stores:

Step 2:

In this step, the For loop iterates using counter variable with counter = 0 to 6. In each of these iterations, the value of the corresponding index pointed by counter is getting added to totalPints.

Step 3:

Chart:

Step 4:

In this step, the program is finding the highest value in the pints array. At first, highPints stores pints[0] as the highest. Then, the program iterates through index = 1 to 6 and in each iteration, highPints stores the highest value up to that index. In each iteration, the code checks if pints[index] is greater than highPints, if it is, then highPints stores pints[index] as the new highest value.

Step 5:

Element 34 39 25 18 43 31 12 Index 0 1 2 3 4 5 6