Well, I did this program and it works, but my instructor wants me to use this statements instead of the one I used:

My original code was:

    Dim DiscountVal As Double = 1.0       'ByVal  arguments passed as by value (chapter VI)
    Dim BasePrice As Double = 9.95         
    Dim AdditionalPrice As Double = 2.0      
    Dim HoursAllowed As Integer = 10
    Dim HoursUsed As Integer = CInt(Me.TextBox1.Text) ' convert to integer
    Dim HoursOver As Integer = 0

    ' Set discount rate for nonprofit.
    If Me.chkNonProfit.Checked Then
        DiscountVal = 0.8           ' value is passed 
    End If

    ' Start branching structure using If..ElseIf

    If Me.radPackageA.Checked Then
        BasePrice = 9.95
        HoursAllowed = 10
        AdditionalPrice = 2.0
    ElseIf Me.radPackageB.Checked Then
        BasePrice = 14.95
        HoursAllowed = 20
        AdditionalPrice = 1.0
    ElseIf Me.radPackage3.Checked Then
        BasePrice = 19.95
        HoursAllowed = Me.TextBox1.Text
        AdditionalPrice = 0
    End If

    HoursOver = HoursUsed - HoursAllowed
    If HoursOver < 0 Then
        HoursOver = 0
    End If
     ' Calculate total.

    Dim Total As Double = DiscountVal * (BasePrice + (AdditionalPrice * HoursOver))

    Me.txtHours.Text = FormatCurrency(Total)

Instead I have to use:

If Me.radPackageA.Checked Then
If CInt (Me.Textbox1.Text) < = 10 Then
     charge = 9.95
else
       charge = 9.95 +2*(CInt(Me.TextBox1.Text)-10)
EndIf

It works for Package A and Package B, but I am having problems coding PackageC

Thank you

Disregard. I fixed it!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.