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

In Visual Basic 10% oo AT&T; LTE 09:57 ay16.moodle umn.edu Exercise 14 Arrays Re

ID: 3773850 • Letter: I

Question

In Visual Basic 10% oo AT&T; LTE 09:57 ay16.moodle umn.edu Exercise 14 Arrays Review CS-1121 Visual Basic Lab Hour Name Here is a list of common tasks you should be able to perform with arrays. Declaring an array Initializing an array with a value list Passing an array into a Sub Procedure or Function Summing up the elements in a numeric array Finding a target value (sequential search) Finding the location of a target value (first, last, all) Counting the number of occurrences of an item in an array Sort an array in ascending order (low to high) Given the array below. Write code that will demonstrate how to accomplish each of the tasks described. Note, these are typical final exam questions. Dim intNum As Integer (13 24, 35, 24, 13, 17,48, 65, 42) Write a function to retum the sum of values in intNum. Write a function to retum True if a target value is in intNum and False if it is not. Write a function to retum the location of the first element with the target.

Explanation / Answer

Function to return sum of the values in intNum

Call the fynction in the following way:

sum(intNum)

Function sum(ByVal intNum() As Integer)
Dim i, sum As Integer
sum = 0
For i = 0 To intNum.Count - 1
sum += intNum(i)
Next
Return sum

End Function

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote