Question

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 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...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor

Related Homework Solutions

Roman Numeral Translator
Homework Solution
$10.00
Computer Science
Word Processing
Characters
Programming
Alice
Roman Numeral Translator
Sentences
Input
Output
Numbers
Speech Bubbles
Discrete Event Simulation
Homework Solution
$60.00
Computer
Science
Python
Programming
Discrete
Event
Simulation
Quarantine
Disease
Java Programming Problems
Homework Solution
$50.00
Java
Programming
Computer Science
Algorithms
Classes
Variables
Inheritance
Polymorphism
Functions
Methods
String
Integers
Commands
Input
Output
Using Excel Templates
Homework Solution
$30.00
Microsoft Excel
Computer Science
Business
Templates
Discussion
Food Inventory
Invoice
Finance
Mathematics
Economics
Monthly Budget
Purchase Orders
Rows
Columns
Conditions
Get help from a qualified tutor
Live Chats