DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   .Net Battler Needing help Desperately lol! (http://www.daniweb.com/forums/thread118017.html)

ferrier18 Apr 8th, 2008 4:04 am
.Net Battler Needing help Desperately lol!
 
Hey guys, This is what im trying to achieve:
Add the code that
• Calculates the total amount (Price * Qty)
• Then apply the following discounts:
• Total is < 20 0% discount
• Total in the range 20-49.99 10% discount
• Total is >50 20% discount
• Subtract the discount from the total
• Finally, display the discounted total amount

And heres what i have so far: I can't go any further cos i'm stuck with absolutely no idea what to do! I would greatly appreciate any help that's given to me... Thanks guys

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim vPrice As Decimal
Dim vQty As Integer
Dim vTotal As Decimal

vPrice = Val(InputBox("Enter a price"))
vQty = Val(InputBox("Enter a qty"))
vTotal = Val(vPrice * vQty)

If vTotal < 20 Then
vTotal = vTotal
ElseIf vTotal >= 20 And vTotal < 49.99 Then
vTotal = Val(vTotal) * Val(1.1)
ElseIf vTotal > 50 Then
vTotal = Val(vTotal) * Val(1.2)
End If
MessageBox.Show("Toal is " & vTotal)
End Sub

Jx_Man Apr 8th, 2008 4:59 am
Re: .Net Battler Needing help Desperately lol!
 
Dim vPrice As Decimal
        Dim vQty As Integer
        Dim vTotal As Decimal
        Dim vDiscount As Decimal
        Dim vFinal As Decimal

        vPrice = Val(InputBox("Enter a price"))
        vQty = Val(InputBox("Enter a qty"))
        vTotal = Val(vPrice * vQty)

        If vTotal < 20 Then
            vDiscount = vTotal
            vFinal = vDiscount
        ElseIf vTotal >= 20 And vTotal < 49.99 Then
            vDiscount = Val(vTotal) * 0.1
            vFinal = (Val(vTotal) - Val(vDiscount))
        ElseIf vTotal > 50 Then
            vDiscount = Val(vTotal) * 0.2
            vFinal = (Val(vTotal) - Val(vDiscount))
        End If
        MessageBox.Show("Final Price is " & vFinal)

unabomber1 Apr 8th, 2008 10:16 am
Re: .Net Battler Needing help Desperately lol!
 
Quote:

End If
MessageBox.Show("Toal is " & vTotal)
End Sub
You havent even tried spell checking! Go read the books before you post your homework.

Jx_Man Apr 8th, 2008 1:38 pm
Re: .Net Battler Needing help Desperately lol!
 
Quote:

Originally Posted by unabomber1 (Post 580002)
You havent even tried spell checking! Go read the books before you post your homework.

don't added other problem. its just a little mistaken in spell.
ok. happy coding :)


All times are GMT -4. The time now is 3:36 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC