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

Determine the output displayed when the button is clicked on. Private Sub btnCal

ID: 3605963 • Letter: D

Question

Determine the output displayed when the button is clicked on.

Private Sub btnCalculate_Click(…) Handles btnCalculate.Click

Dim wholesaleCost, salePrice, percentCommission,

salesTax, profit As Decimal

InputData(wholesaleCost, salePrice, percentCommission)

CalculateSomeValues(wholesaleCost, salePrice, percentCommission, salesTax,profit)

DisplayData(salesTax, profit)

End Sub

Sub InputData(ByRefWholesaleCost As Decimal, ByRef salePrice As Decimal, ByRef percentCommission As Decimal)

wholesaleCost=100

salePrice=300

percentCommission=5

End Sub

Sub CalculateSomeValues(wholesaleCost As Decimal, salePrice As Decimal, percentCommission As Decimal, ByRef profit As Decimal)

salesTax=0.06D*salePrice

profit=salePrice-wholesaleCost-salePrice*(percentCommission/100)

End Sub

Sub DisplayData(salesTax As Decimal, profit As Decimal)

lstOutput.Items.Add(“sales tax: ”&salesTax.ToString(“C”))

lstOutput.Items.Add(“profit: “ & profit.ToString(“C”))

End Sub

Explanation / Answer

When the button is clicked, no output will be displayed but the following values will be added to the list lstOutput.

Following is the explainiation of each of the functions called when the button is clicked.

InputData(wholesaleCost, salePrice, percentCommission)

Here, the initial values will be set which are wholesaleCost=100, salePrice=300, percentCommission=5

Since the values are passed by reference, the values will persist even after function call

CalculateSomeValues(wholesaleCost, salePrice, percentCommission, salesTax,profit)

Here, salesTax and profit will be calculated.

salesTax=0.06*salesPrice = 0.06*300 = 18

profit=salePrice-wholesaleCost-salePrice*(percentCommission/100) = 300-100-(300*5/100) = 300-115 = 185

DisplayData(salesTax, profit)

In this subroutine, the values are added to the lstOutput list as string in currency format. So the following will be added:

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