QuestionQuestion

Solve the following problems written the Visual Basic statement that accomplish the execution of each of the applications. Follow the instructions give in each case. Remember, each problem should be solved as a different project. Don’t forget to verify whether each application runs correctly before submit your job.

Use a one-dimensional array to solve the following problem: A company pays its salespeople on a commission basis. The salespeople receive $200 per week, plus 9% of their gross sales for that week. For example, a salesperson who grosses $5,000 in sales in a week receives $200 plus 9% of $5,000, a total of $650. Write an application (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges(assuming that each salesperson’s salary is truncated to an integer
amount): $200-299, $300-399, $400-499, $500-599, $600-699, $700-799, $800-899, $900-999 and over $999.

Allow the user enter the sales foe each employee in a TextBox. The user clicks the Calculate Button to calculate the salesperson’s salary. When the user is done entering this information, clicking the Show Totals Button displays how many of the salespeople earned in each of the above ranges.

1. This function declares numbers as its parameter. What does it returns?

1 Function Mystery(ByVal numbers( ) As Integer) As Integer( )
2 Dim length As Integer = numbers.Length - 1
3 Dim tempArray(length) As Integer
4
5 For I As Integer = length To 0 Step – 1
6 tempArray(length – i) = numbers(i)
7 Next
8
9 Return tempArray
10 End Function

2. The code that follows uses a For … Next loop to sum the elements in an array. Find the error(s) in the following code:

1 Sub SumArray( )
2 Dim sum As Integer
3 Dim numbers () As Integer = {1, 2, 3, 4, 5, 6, 7, 8}
4
5 For counter As Integer = 0 To numbers.Length
6 Sum += numbers(counter)
7 Next
8 End Sub ‘ SunArray

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

1. This function declares numbers as its parameter. What does it returns?
Function Mystery(ByVal numbers( ) As Integer) As Integer()
Dim length As Integer = numbers.Length - 1
Dim tempArray(length) As Integer
For I As Integer = length To 0 Step – 1
tempArray(length – i) = numbers(i)
Next
Return tempArray
End Function

The array returns the array in order going from last to first element
Example: The original array would be {1 2 3 4 5} and the result would be {5,4,3,2,1}

Sub SumArray( )
Dim sum As Integer
For counter As Integer = 0 To numbers.Length
   Sum += numbers(counter)
Next
End Sub
‘ SunArray...
$20.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Visual Basic Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats