I need help I am using Visual Basic 2012 Express The project

I need help. I am using Visual Basic 2012 Express.

The project is designed to allow the users to select an Internet Service Provider (ISP) service package and calculate their monthly bill based on their ISP usage and package selection.

The ISP provider has 3 packages available, as well as a 20% discount for non-profit organizations.

1. Package A: 10 hours of access for R9.95 per month and any additional hours are R2.00 per hour.[RM1]

2. Package B: 20 hours of access for R14.95 per month and any additional hours are R1.00 per hour.

3. Package C: Unlimited access for R19.95 per month.

Your program should present a user interface similar to the one below. All controls and variables should have appropriate names, and your code should be properly formatted (indented and spaced) and commented (see Coding Specifications handout).

The form should contain a set of radio buttons to select the desired ISP package, a check box to indicate if they are a non-profit organization and allow input for the number of hours they use their ISP per month. The form should not allow the user to minimize, maximize, or resize.

You must declare constants for the minimum (1) and maximum (744) hours per month they can use their ISP. You must declare variables to store data, and they must be of the narrowest scope possible (module-level variables are OK if multiple event procedures need to access their data). You should not accept inappropriate entries from the user (empty, non-numeric, outside the acceptable range) – instead you should request a new, appropriate value. However, the prior entry, whether acceptable or not, should remain in the text box, and be selected/highlighted.

The Exit button on the form should cause your program to stop running.

The Clear button should reset the form to the default when the form is first displayed.

In addition to the specific requirements itemized above, you should make sure that the tab index order is functional, focus is appropriate, and that the overall interface is as user-friendly as possible. The Enter button should be the Default (Calculate) button, any presentation of numbers should be right-aligned, and there should be Access keys as indicated. Also be sure that the user is not able to change the value for the Total Amount Due.

[RM1]Remove dollar signs and use R’s

Add a comparison functionality that will display any potential savings for the customer based on their package selection and ISP usage. The updated form should be as displayed below.Add a check box for Display Potential Savings, that when checked will display the amount Package A customers would save if they selected Package B or C, or the amount Package B customers would save if they selected Package C. If there is no savings, the message should indicate that instead.

Solution

Form1.vb

\' Naomi Crosby


Public Class Form1

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        \' Close Form
        Me.Close()
    End Sub

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        \' Clear and reset defaults and focus
        radPkgA.Checked = True
        radPkgB.Checked = False
        radPkgC.Checked = False

        chkNonprofitOrg.Checked = False
        txtNumHours.Text = String.Empty
        lblAmountDue.Text = String.Empty
        txtNumHours.Focus()
    End Sub

    Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
        \' Declare variables
        Const dblNonprofitDiscount As Double = 0.2
        \' package variables
        Const dblPackage_A As Double = 9.95      \' 10 hours max
        Const dblExtraHours_A As Double = 2.0
        Const intHourLimit_A As Integer = 10
        Const dblPackage_B As Double = 14.95     \' 20 hours max
        Const dblExtraHours_B As Double = 1.0
        Const intHourLimit_B As Integer = 20
        Const dblPackage_C As Double = 19.95     \' Unlimited hours

        Dim intHours As Integer = 0
        Dim intOverLimitHourCount As Integer = 0
        Dim dblSubtotal As Double = 0
        Dim dblTotal As Double = 0
        Dim dblTempAmount As Double = 0

        Try
            intHours = CInt(txtNumHours.Text) \' Hours used by organization cannot exceed 744
            If IsNumeric(txtNumHours.Text) Then         \' Making sure the input is numeric
                If CInt(txtNumHours.Text) > 745 Then    \' Making sure the hours are not above 744, van equal 744 though
                    MessageBox.Show(\"Hour total cannot exceed 744 per month.\")
                    txtNumHours.Clear()
                    txtNumHours.Focus()
                Else
                    \' Since the Hours input has been validated, calculations can occur
                    \' Package A
                    If radPkgA.Checked = True Then
                        If intHours <= intHourLimit_A Then \' determine if max hours have been reached
                            dblSubtotal = dblPackage_A
                        Else
                            intOverLimitHourCount = CInt(intHours - intHourLimit_A)     \' Figure out how many extra hours
                            dblSubtotal = dblPackage_A + (intOverLimitHourCount * dblExtraHours_A) \' Calculate those into price
                        End If
                    ElseIf radPkgB.Checked = True Then \' Package B
                        If intHours <= intHourLimit_B Then \' determine if max hours have been reached
                            dblSubtotal = dblPackage_B
                        Else
                            intOverLimitHourCount = CInt(intHours - intHourLimit_B) \' Figure out how many extra hours
                            dblSubtotal = dblPackage_B + (intOverLimitHourCount * dblExtraHours_B) \' Calculate those into price
                        End If
                    Else
                        dblSubtotal = dblPackage_C      \' Package C
                    End If

                    If chkNonprofitOrg.Checked = True Then \' If NON profit is checked
                        dblTempAmount = dblSubtotal * dblNonprofitDiscount
                        dblTotal = dblSubtotal - dblTempAmount
                    Else
                        dblTotal = dblSubtotal
                    End If

                    lblAmountDue.Text = dblTotal.ToString(\"c\") \' Add to the lbl for display

                End If
            Else
                MessageBox.Show(\"Please enter only numbers.\")
                txtNumHours.Clear()
                txtNumHours.Focus()
            End If
        Catch ex As InvalidCastException
            MessageBox.Show(\"Please enter a number\")
            txtNumHours.Clear()
            txtNumHours.Focus()
        End Try
    End Sub
End Class


Form1.Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
    Inherits System.Windows.Forms.Form

    \'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    \'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    \'NOTE: The following procedure is required by the Windows Form Designer
    \'It can be modified using the Windows Form Designer.
    \'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.btnCalculate = New System.Windows.Forms.Button()
        Me.btnClear = New System.Windows.Forms.Button()
        Me.btnExit = New System.Windows.Forms.Button()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.GroupBox2 = New System.Windows.Forms.GroupBox()
        Me.chkNonprofitOrg = New System.Windows.Forms.CheckBox()
        Me.radPkgC = New System.Windows.Forms.RadioButton()
        Me.radPkgB = New System.Windows.Forms.RadioButton()
        Me.radPkgA = New System.Windows.Forms.RadioButton()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.lblAmountDue = New System.Windows.Forms.Label()
        Me.txtNumHours = New System.Windows.Forms.TextBox()
        Me.GroupBox1.SuspendLayout()
        Me.GroupBox2.SuspendLayout()
        Me.SuspendLayout()
        \'
        \'btnCalculate
        \'
        Me.btnCalculate.Location = New System.Drawing.Point(27, 198)
        Me.btnCalculate.Name = \"btnCalculate\"
        Me.btnCalculate.Size = New System.Drawing.Size(75, 35)
        Me.btnCalculate.TabIndex = 7
        Me.btnCalculate.Text = \"&Calculate\"
        Me.btnCalculate.UseVisualStyleBackColor = True
        \'
        \'btnClear
        \'
        Me.btnClear.Location = New System.Drawing.Point(123, 198)
        Me.btnClear.Name = \"btnClear\"
        Me.btnClear.Size = New System.Drawing.Size(75, 35)
        Me.btnClear.TabIndex = 8
        Me.btnClear.Text = \"Clea&r\"
        Me.btnClear.UseVisualStyleBackColor = True
        \'
        \'btnExit
        \'
        Me.btnExit.Location = New System.Drawing.Point(219, 198)
        Me.btnExit.Name = \"btnExit\"
        Me.btnExit.Size = New System.Drawing.Size(75, 35)
        Me.btnExit.TabIndex = 9
        Me.btnExit.Text = \"E&xit\"
        Me.btnExit.UseVisualStyleBackColor = True
        \'
        \'GroupBox1
        \'
        Me.GroupBox1.Controls.Add(Me.GroupBox2)
        Me.GroupBox1.Controls.Add(Me.radPkgC)
        Me.GroupBox1.Controls.Add(Me.radPkgB)
        Me.GroupBox1.Controls.Add(Me.radPkgA)
        Me.GroupBox1.Location = New System.Drawing.Point(12, 12)
        Me.GroupBox1.Name = \"GroupBox1\"
        Me.GroupBox1.Size = New System.Drawing.Size(297, 105)
        Me.GroupBox1.TabIndex = 0
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = \"Select a Subscription Package\"
        \'
        \'GroupBox2
        \'
        Me.GroupBox2.Controls.Add(Me.chkNonprofitOrg)
        Me.GroupBox2.Location = New System.Drawing.Point(127, 50)
        Me.GroupBox2.Name = \"GroupBox2\"
        Me.GroupBox2.Size = New System.Drawing.Size(170, 55)
        Me.GroupBox2.TabIndex = 4
        Me.GroupBox2.TabStop = False
        Me.GroupBox2.Text = \"Select a Discount\"
        \'
        \'chkNonprofitOrg
        \'
        Me.chkNonprofitOrg.AutoSize = True
        Me.chkNonprofitOrg.Location = New System.Drawing.Point(33, 23)
        Me.chkNonprofitOrg.Name = \"chkNonprofitOrg\"
        Me.chkNonprofitOrg.Size = New System.Drawing.Size(131, 17)
        Me.chkNonprofitOrg.TabIndex = 5
        Me.chkNonprofitOrg.Text = \"&Nonprofit Organization\"
        Me.chkNonprofitOrg.UseVisualStyleBackColor = True
        \'
        \'radPkgC
        \'
        Me.radPkgC.AutoSize = True
        Me.radPkgC.Location = New System.Drawing.Point(15, 74)
        Me.radPkgC.Name = \"radPkgC\"
        Me.radPkgC.Size = New System.Drawing.Size(78, 17)
        Me.radPkgC.TabIndex = 3
        Me.radPkgC.Text = \"Package &C\"
        Me.radPkgC.UseVisualStyleBackColor = True
        \'
        \'radPkgB
        \'
        Me.radPkgB.AutoSize = True
        Me.radPkgB.Location = New System.Drawing.Point(15, 50)
        Me.radPkgB.Name = \"radPkgB\"
        Me.radPkgB.Size = New System.Drawing.Size(78, 17)
        Me.radPkgB.TabIndex = 2
        Me.radPkgB.Text = \"Package &B\"
        Me.radPkgB.UseVisualStyleBackColor = True
        \'
        \'radPkgA
        \'
        Me.radPkgA.AutoSize = True
        Me.radPkgA.Checked = True
        Me.radPkgA.Location = New System.Drawing.Point(15, 26)
        Me.radPkgA.Name = \"radPkgA\"
        Me.radPkgA.Size = New System.Drawing.Size(78, 17)
        Me.radPkgA.TabIndex = 1
        Me.radPkgA.TabStop = True
        Me.radPkgA.Text = \"Package &A\"
        Me.radPkgA.UseVisualStyleBackColor = True
        \'
        \'Label1
        \'
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(36, 135)
        Me.Label1.Name = \"Label1\"
        Me.Label1.Size = New System.Drawing.Size(167, 13)
        Me.Label1.TabIndex = 4
        Me.Label1.Text = \"Enter the Number of Hours Used: \"
        \'
        \'Label2
        \'
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(104, 166)
        Me.Label2.Name = \"Label2\"
        Me.Label2.Size = New System.Drawing.Size(99, 13)
        Me.Label2.TabIndex = 5
        Me.Label2.Text = \"Total Amount Due: \"
        \'
        \'lblAmountDue
        \'
        Me.lblAmountDue.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.lblAmountDue.Location = New System.Drawing.Point(209, 161)
        Me.lblAmountDue.MinimumSize = New System.Drawing.Size(100, 20)
        Me.lblAmountDue.Name = \"lblAmountDue\"
        Me.lblAmountDue.Size = New System.Drawing.Size(100, 23)
        Me.lblAmountDue.TabIndex = 6
        Me.lblAmountDue.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        \'
        \'txtNumHours
        \'
        Me.txtNumHours.Location = New System.Drawing.Point(209, 132)
        Me.txtNumHours.Name = \"txtNumHours\"
        Me.txtNumHours.Size = New System.Drawing.Size(100, 20)
        Me.txtNumHours.TabIndex = 6
        \'
        \'Form1
        \'
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(321, 251)
        Me.Controls.Add(Me.txtNumHours)
        Me.Controls.Add(Me.lblAmountDue)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.GroupBox1)
        Me.Controls.Add(Me.btnExit)
        Me.Controls.Add(Me.btnClear)
        Me.Controls.Add(Me.btnCalculate)
        Me.Name = \"Form1\"
        Me.Text = \"Internet Service Provider, Part 1\"
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox1.PerformLayout()
        Me.GroupBox2.ResumeLayout(False)
        Me.GroupBox2.PerformLayout()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents btnCalculate As System.Windows.Forms.Button
    Friend WithEvents btnClear As System.Windows.Forms.Button
    Friend WithEvents btnExit As System.Windows.Forms.Button
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
    Friend WithEvents chkNonprofitOrg As System.Windows.Forms.CheckBox
    Friend WithEvents radPkgC As System.Windows.Forms.RadioButton
    Friend WithEvents radPkgB As System.Windows.Forms.RadioButton
    Friend WithEvents radPkgA As System.Windows.Forms.RadioButton
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents lblAmountDue As System.Windows.Forms.Label
    Friend WithEvents txtNumHours As System.Windows.Forms.TextBox

End Class

I need help. I am using Visual Basic 2012 Express. The project is designed to allow the users to select an Internet Service Provider (ISP) service package and c
I need help. I am using Visual Basic 2012 Express. The project is designed to allow the users to select an Internet Service Provider (ISP) service package and c
I need help. I am using Visual Basic 2012 Express. The project is designed to allow the users to select an Internet Service Provider (ISP) service package and c
I need help. I am using Visual Basic 2012 Express. The project is designed to allow the users to select an Internet Service Provider (ISP) service package and c
I need help. I am using Visual Basic 2012 Express. The project is designed to allow the users to select an Internet Service Provider (ISP) service package and c
I need help. I am using Visual Basic 2012 Express. The project is designed to allow the users to select an Internet Service Provider (ISP) service package and c

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site