Want to calculate a 10% discount on sales made


Subject: Excel VBA (for Computer-Based Decision Support Systems)

Spreadsheet Coding discounts. This is a sample problem of what I'm likely to see on my midterm tomorrow. We quickly threw the code together (see below the question) but this professor is an extreme perfectionist --style counts. We're new to all of this, so our confidence isn't very high and there's often a lot of guess and check. Hoping someone that knows what they're doing can code this so we can compare it side by side. Lots of other material to cover by sunrise so we really can't afford to spend much more time on this.
________________________________________

Question:
Assume you want to calculate a 10% discount on sales made to customers in California and in Texas, a 7% discount on sales made to customers in Oregon and New Mexico, and a 6% discount on sales made to customers in all other states. The state is entered in the strState variable, and the sales amount is entered in the curSales variable. Format the discount to Standard and display it in the lblDisc Control. (You don't know the case of the strState variable. In other words, the contents of the variable might be in uppercase, lowercase, or a combination of uppercase and lowercase letters.) 

__________________________________________________
Our solution:

Private Sub State_Discount()

Dim strState As String
Dim curSales As Integer

strState = UCase(strState)
If strState = "CALIFORNIA" Or strState = "TEXAS" Or strState = "CA" Or strState = "TX" Then
lblDisc.Caption = 0.1 * curSales
ElseIf strState = "OREGON" Or strState = "NEW MEXICO" Or strState = "OR" Or strState = "NM" Then
lblDisc.Caption = 0.07 * curSales
Else
lblDisc.Caption = 0.06 * curSales
End If
lblDisc.Caption = Format(lblDisc.Caption, "General")
End Sub 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Want to calculate a 10% discount on sales made
Reference No:- TGS097124

Expected delivery within 24 Hours