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 = "R"
Dim Customertypetwo As Char = "C"
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("Please enter Customer Type")
End Try

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

MsgBox("Please enter Subtotal")


End Try




If Customertype = Me.TextBox1.Text Then


If Subtotal < 249.99 Then




decDiscountAmount = Subtotal * decDiscount




Me.Label1.Text = "10%"
Me.Label2.Text = decDiscountAmount.ToString("C")
Me.Label3.Text = "$" & Subtotal - decDiscountAmount.ToString("C")
End If

'If Customertype = Me.TextBox1.Text Then

If Subtotal > 249.99 Then

decDiscountAmount = Subtotal * decDiscountThree


Me.Label1.Text = "25%"
Me.Label2.Text = decDiscountAmount.ToString("C")
Me.Label3.Text = "$" & Subtotal - decDiscountAmount.ToString("C")

End If

'If Customertype = Me.TextBox1.Text Then

If Subtotal < 100 Then




MsgBox("Subtototal must be over 100.00 to receive discount", , "Input Error")


Me.TextBox2.Focus()
Me.Label1.Text = ""
Me.Label2.Text = ""
Me.Label3.Text = ""
Me.TextBox2.Text = ""

InputError = True


End If



Else


If Customertypetwo = Me.TextBox1.Text Then


If Subtotal < 249.99 Then






decDiscountAmount = Subtotal * decDiscountTwo


Me.Label1.Text = "20%"
Me.Label2.Text = decDiscountAmount.ToString("C")
Me.Label3.Text = "$" & Subtotal - decDiscountAmount.ToString("C")


End If


If Customertypetwo = Me.TextBox1.Text Then

If Subtotal > 250.0 Then




decDiscountAmount = Subtotal * decDiscountFive

Me.Label1.Text = "30%"
Me.Label2.Text = decDiscountAmount.ToString("C")
Me.Label3.Text = "$" & Subtotal - decDiscountAmount.ToString("C")
End If



ElseIf Customertypeone = Me.TextBox1.Text Then

ElseIf Subtotal > 0.0 Then


decDiscountAmount = Subtotal * decDiscountFour

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



End If
End If
End If
1
Expert's answer
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS