Please determine the final outcome that is displayed when the buttonis clicked f
ID: 3701892 • Letter: P
Question
Please determine the final outcome that is displayed when the buttonis clicked for this program.
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(ByRef wholesaleCost 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 salesTax As Decimal,
ByRef profit As Decimal)
salesTax = 0.06D * salePrice
profit = salePrice – wholesaleCost –
salePrice * (percentCommission / 100)
End Sub
Sub DisplayDatat(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
The Final Output of this program:
'lstOutput' is of type 'List' in method "DisplayDatat(salesTax As Decimal,Profit As Decimal)" which is storing the two values.
In the first Index it will store the string as = "sales tax: $18.00"
In the second Index it will store the string as = "profit: $185.00"
Here in the ".ToString()" method having a character 'C' as a parameter which means Currency.