943,907 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 877
  • VB.NET RSS
Apr 8th, 2008
0

.Net Battler Needing help Desperately lol!

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ferrier18 is offline Offline
5 posts
since Mar 2008
Apr 8th, 2008
0

Re: .Net Battler Needing help Desperately lol!

VB.NET Syntax (Toggle Plain Text)
  1. Dim vPrice As Decimal
  2. Dim vQty As Integer
  3. Dim vTotal As Decimal
  4. Dim vDiscount As Decimal
  5. Dim vFinal As Decimal
  6.  
  7. vPrice = Val(InputBox("Enter a price"))
  8. vQty = Val(InputBox("Enter a qty"))
  9. vTotal = Val(vPrice * vQty)
  10.  
  11. If vTotal < 20 Then
  12. vDiscount = vTotal
  13. vFinal = vDiscount
  14. ElseIf vTotal >= 20 And vTotal < 49.99 Then
  15. vDiscount = Val(vTotal) * 0.1
  16. vFinal = (Val(vTotal) - Val(vDiscount))
  17. ElseIf vTotal > 50 Then
  18. vDiscount = Val(vTotal) * 0.2
  19. vFinal = (Val(vTotal) - Val(vDiscount))
  20. End If
  21. MessageBox.Show("Final Price is " & vFinal)
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,140 posts
since Nov 2007
Apr 8th, 2008
0

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
unabomber1 is offline Offline
3 posts
since Apr 2008
Apr 8th, 2008
0

Re: .Net Battler Needing help Desperately lol!

Click to Expand / Collapse  Quote originally posted by unabomber1 ...
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
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,140 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: DataGridView integer problem?
Next Thread in VB.NET Forum Timeline: [Databinding]





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC