| | |
.Net Battler Needing help Desperately lol!
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Mar 2008
Posts: 5
Reputation:
Solved Threads: 0
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
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
VB.NET Syntax (Toggle Plain Text)
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)
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
So, Please do something before post your thread.
* PM Asking will be ignored *
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: DataGridView integer problem?
- Next Thread: [Databinding]
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2008 access add application arithmetic array assignment basic beginner box button buttons click code combo component connectionstring convert cpu cuesent data database databasesearch datagrid datagridview datetimepicker design designer dissertation dissertations dissertationthesis dosconsolevb.net editvb.net exists firewall folder forms html image images isnumericfuntioncall listview math mobile module mssqlbackend mysql navigate number opacity open peertopeervideostreaming picturebox1 picturebox2 port print printpreview problemwithinstallation project record regex reports" reuse right-to-left savedialog serial settings socket sqldatbase sqlserver storedprocedure string temp textbox timer txttoxmlconverter updown useraccounts usercontol usercontrol vb vb.net vb.netcode vb.nettoolboxvisualbasic2008sidebar vbnet view vista visual visualbasic visualbasic.net visualstudio visualstudio.net web wpf wrapingcode xml






