Problems - Correcting Logic and Code Errors
The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
An application allows the user to enter a salary amount. The application should then calculate and display the possible bonuses based on that salary, using bonus rates of 3-6% in increments of .5%.
' displays bonus amounts using rates
' of 3% - 6% in increments of .5%
Dim dblSalary As Decimal
Dim decBonus As Decimal
TryParse(txtSalary.Text, decSalary)
lblBonus.Text = String.Empty
For decRate As Decimal = 0.03 To 0.06 Step 0.5
decBonus = decSalary + decRate
lblBonus.Text = lblBonus.Text & decRate.ToString("P1") & " " & decBonus.ToString("C2") & ControlChars.NewLine
Next decRate
Correct Answer:
Verified
Deci...
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q43: Write two different Do...Loop clauses that stop
Q44: Explain the difference between a looping condition
Q45: What is the Refresh method? Write the
Q47: The strCode variable contains an uppercase letter.Write
Q48: Case-Based Critical Thinking Questions Case 1 -
Q51: The following sample of code contains errors.
Q53: Write a pretest loop that adds together
Q55: Write a counter-controlled loop that adds 5,10,15,20,25,and
Q56: Write the assignment statements needed to increment
Q59: What is a counter-controlled loop and when
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents