I am working on a homework assignment and have been hashing it out for days. Hopefully my novice status with this wears off soon. I am supposed to create an ISP calculator with checked radio buttons and the user enters the hours.
Package A = $9.95 for 10 hours each hour after that is $2/hour
Package B = $14.95 for 20 hours each hour after that is $1/hour
Package C = $19.95 unlimited monthly access.

Max hours to be used is 744 hours per month.

I've tried everything I can think of and I have no idea where I am going wrong and our instructor doesn't respond to emails and I am taking this course online. Any tips or help would be appreciated. I don't expect anyone to do my homework by any means but I have no idea what I am doing wrong. When I debug for package A it just tells me that it's $9.95 no matter how many hours I input and for package B it tells me $0.00 but the codes are the same.

Private Sub btnCalculate_Click( ByVal sender As System.Object,  ByVal e As System.EventArgs) Handles btnCalculate.Click

        Dim decCharges As Decimal
        Dim intHours As Integer


        Const decA As Decimal = 9.95D
        Const decB As Decimal = 14.95D
        Const decC As Decimal = 19.95D




        inthours = CInt(txtHours.Text)


If radA.Checked = True then

        If intHours >= 10 then

                decCharges = decA

            Else  
                If intHours <10 and intHours >744 then
                decCharges = intHours * 2

        End if 

End If


 If radB.Checked = True then

        If intHours >= 20 then

                decCharges = decB
            Else 

            If IntHours <10 and intHours > 744 then
                DecCharges = intHours *2 

            End If

            End If


        End If


End If

 If radC.Checked = True then

        If intHours >= 744 then

                decCharges = decC

        End If


End If

lblTotal.Text = decCharges.ToString("c")         




End Sub

If you use proper indentation then the solution becomes more obvious.

Dim decCharges As Decimal
Dim intHours As Integer

Const decA As Decimal = 9.95D
Const decB As Decimal = 14.95D
Const decC As Decimal = 19.95D

inthours = CInt(txtHours.Text)

If radA.Checked = True Then
    If intHours >= 10 Then
        decCharges = decA
    Else
        If intHours < 10 And intHours > 744 Then
            decCharges = intHours * 2
        End If
    End If

    If radB.Checked = True Then
        If intHours >= 20 Then
            decCharges = decB
        Else
            If intHours < 10 And intHours > 744 Then
                decCharges = intHours * 2
            End If
        End If
    End If

End If

If radC.Checked = True Then
    If intHours >= 744 Then
        decCharges = decC
    End If
End If

lblTotal.Text = decCharges.ToString("c")

You should not introduce so many blank lines. It reduces the number of lines of code that are visible at one time. Use just enough to form logical groupings of code. You could also use the Select Case True form to improve readability and structure even more. In that case you get

Dim decCharges As Decimal
Dim intHours As Integer

Const decA As Decimal = 9.95D
Const decB As Decimal = 14.95D
Const decC As Decimal = 19.95D

intHours = CInt(txtHours.Text)

Select Case True

    Case radA.Checked

        If intHours >= 10 Then
            decCharges = decA
        Else
            If intHours < 10 And intHours > 744 Then
                decCharges = intHours * 2
            End If
        End If

    Case radB.Checked

        If intHours >= 20 Then
            decCharges = decB
        Else
            If intHours < 10 And intHours > 744 Then
                decCharges = intHours * 2
            End If
        End If

    Case radC.Checked

        If intHours >= 744 Then
            decCharges = decC
        End If

End Select

lblTotal.Text = decCharges.ToString("c")

Note that the logic is likely still incorrect as there are values of intHours for which no calculation is done.

commented: I wish all used proper indentation. +5
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.