Problems: Correcting Code ErrorsThe following samples of code contain errors. Rewrite the incorrect statements to correct all errors.
Private Sub btnCalc_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCalc.Click' calculates and displays the total amount owed for purchasing hats' user enters number of hats and price per hat' all hats are on sale for 25% off the priceDim dblNumHats As IntegerDim decHatPrice As DecimalDim decDiscount As DoubleDim decTotal As Decimal' assign number of hats and price to variablesInteger.TryPurse(txtNumHats.Text, intNumHats)Decimal.TryParse(txtHatPrice, decHatPrice)' calculate and display the total amount oweddecDiscount = decHatPrice * dblRATEdecTotal = (intNumHats + decHatPrice) - decDiscountTotal.Text = decTotal.ToString(C2)End Sub

What will be an ideal response?

Dim intNumHats As Integer

Const dblRATE As Double = 0.25

Integer.TryParse(txtNumHats.Text, intNumHats)

Decimal.TryParse(txtHatPrice.Text, decHatPrice)

decTotal = intNumHats * (decHatPrice - decDiscount)

lblTotal.Text = decTotal.ToString("C2")

Computer Science & Information Technology

You might also like to view...

The focus of _________ is defining an identity for each user, associating attributes with the identity, and enforcing a means by which a user can verify identity.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Arrays, like all objects, are passed by value.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology