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

Chapter 9 Question 17E Open the SwatTheBugs Solution file contained in the Clear

ID: 3832837 • Letter: C

Question

Chapter 9 Question 17E

Open the SwatTheBugs Solution file contained in the ClearlyVB2012Chap09SwatTheBugs Solution folder. The application should calculate an 8% bonus on a salesperson's sales. However, a salesperson having a sales code of 5 reeives an additional $150 bonus when the sales are at least $10,000; othewise, he or she receives an additional $125 bonus. Open the Code Editor window and study the code. Start and then test the application. Notice that the code is not working correctly. Locate and correct any errors. Close the Code Editor window and then close the solution.

Explanation / Answer

Sub bonuscalc()
Dim bonus As Double
Dim addtb As Double
Row = 17
Do While Not IsEmpty(Sheet5.Range("W:W"))
Sheet5.Cells(Row, 25).Value = 0.08 * Sheet5.Cells(Row, 23).Value
If (Sheet5.Cells(Row, 24).Value = 5 And Sheet5.Cells(Row, 23).Value >= 10000) Then
Sheet5.Cells(Row, 26).Value = 150
Row = Row + 1
Else
Sheet5.Cells(Row, 26).Value = 125
Row = Row + 1
End If

Loop


End Sub