98 713
Assignments Done
98.6%
Successfully Done
In April 2021

Answer to Question #38812 in Visual Basic for Emmylou Septelka

Question #38812
I can get everything but the 40% working what am I doing wrong?

Protected Sub Button3_Click(sender As Object, e As System.EventArgs) Handles Button3.Click

Dim Customertype As Char = &quot;R&quot;
Dim Customertypetwo As Char = &quot;C&quot;
Dim Customertypethree As Char
Dim Customertypeone As Char = (TextBox1.Text)

Dim decSubtotalone As Decimal = 100D - 249.99D

Dim Subtotal As Decimal

Dim decDiscount As Decimal = 0.1D
Dim decDiscountTwo As Decimal = 0.2D
Dim decDiscountThree As Decimal = 0.25D
Dim decDiscountFour As Decimal = 0.4D
Dim decDiscountFive As Decimal = 0.3D

Dim decDiscountAmount As Decimal

Dim InputError As Boolean = False

Try
Customertypethree = Convert.ToChar(Me.TextBox1.Text)
Catch ex As Exception

MsgBox(&quot;Please enter Customer Type&quot;)
End Try

Try
Subtotal = Convert.ToDecimal(Me.TextBox2.Text)
Catch ex As FormatException

End Try

If Customertype = Me.TextBox1.Text Then

If Subtotal &lt; 249.99 Then

decDiscountAmount = Subtotal * decDiscount

Me.Label1.Text = &quot;10%&quot;
Me.Label2.Text = decDiscountAmount.ToString(&quot;C&quot;)
Me.Label3.Text = &quot;$&quot; & Subtotal - decDiscountAmount.ToString(&quot;C&quot;) End If 'If Customertype = Me.TextBox1.Text Then If Subtotal &gt; 249.99 Then decDiscountAmount = Subtotal * decDiscountThree Me.Label1.Text = &quot;25%&quot; Me.Label2.Text = decDiscountAmount.ToString(&quot;C&quot;) Me.Label3.Text = &quot;$&quot; & Subtotal - decDiscountAmount.ToString(&quot;C&quot;)

End If

'If Customertype = Me.TextBox1.Text Then

If Subtotal &lt; 100 Then

MsgBox(&quot;Subtototal must be over 100.00 to receive discount&quot;, , &quot;Input Error&quot;)

Me.TextBox2.Focus()
Me.Label1.Text = &quot;&quot;
Me.Label2.Text = &quot;&quot;
Me.Label3.Text = &quot;&quot;
Me.TextBox2.Text = &quot;&quot;

InputError = True

End If

Else

If Customertypetwo = Me.TextBox1.Text Then

If Subtotal &lt; 249.99 Then

decDiscountAmount = Subtotal * decDiscountTwo

Me.Label1.Text = &quot;20%&quot;
Me.Label2.Text = decDiscountAmount.ToString(&quot;C&quot;)
Me.Label3.Text = &quot;$&quot; & Subtotal - decDiscountAmount.ToString(&quot;C&quot;) End If If Customertypetwo = Me.TextBox1.Text Then If Subtotal &gt; 250.0 Then decDiscountAmount = Subtotal * decDiscountFive Me.Label1.Text = &quot;30%&quot; Me.Label2.Text = decDiscountAmount.ToString(&quot;C&quot;) Me.Label3.Text = &quot;$&quot; & Subtotal - decDiscountAmount.ToString(&quot;C&quot;)
End If

ElseIf Customertypeone = Me.TextBox1.Text Then

ElseIf Subtotal &gt; 0.0 Then

decDiscountAmount = Subtotal * decDiscountFour

Me.Label1.Text = &quot;40%&quot;
Me.Label2.Text = decDiscountAmount.ToString(&quot;C&quot;)
Me.Label3.Text = &quot;\$&quot; & Subtotal - decDiscountAmount.ToString(&quot;C&quot;)

End If
End If
End If
1
2014-02-03T09:37:43-0500
Dear customer,
Unfortunately, your question requires a lot of work and cannot be done for free.
Please submit it with all requirements as an assignment to our control panel and
we'll assist you.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!