I am using visual Studio Express 2012 and have to write a pr
I am using visual Studio Express 2012 and have to write a program in visual basic as follows. 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. 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. I have tried various approaches but get code execution errors.
Solution
Public Class Form1
\' Declare Variables
Dim PackageA As Decimal
Dim PackageB As Decimal
Dim PackageC As Integer
Dim Hours As Decimal
Dim Price As Integer
Dim Additional As Integer
Dim Total As Integer
Dim Nonprofit As Decimal
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
\' Fill Variables with Data
Additional = 0
PackageA = 9.95
PackageB = 14.95
PackageC = 19.95
Nonprofit = 0.2
\'Calculate the price and Display
If radA.Checked = True Then
lblTotal.Text = PackageA.ToString(\"C2\")
ElseIf rada.Checked = True And Hours > 10 Then
Additional = 2.0 * Hours > 10
Total = Additional + PackageA
lblTotal.Text = Total.ToString(\"C2\")
End If
If RadB.Checked = True Then
lblTotal.Text = PackageB.ToString(\"C2\")
ElseIf RadB.Checked = True And Hours > 10 Then
Additional = 1.0 * Hours > 10
Total = Additional + PackageB
lblTotal.Text = Total.ToString(\"C2\")
End If
If RadC.Checked = True Then
lblTotal.Text = PackageC.ToString(\"C2\")
End If
\'Determine the discount, based nonprofit organization and Display Total
If radA.Checked And ChkNonprofit.Checked = True Then
Additional = 2.0 * Hours > 10
Price = PackageA * Nonprofit
Total = Additional + Price
lblTotal.Text = Total.ToString(\"C2\")
ElseIf RadB.Checked And ChkNonprofit.Checked = True Then
Additional = 1.0 * Hours > 10
Price = PackageB * Nonprofit
Total = Additional + Price
lblTotal.Text = Total.ToString(\"C2\")
ElseIf RadC.Checked And ChkNonprofit.Checked = True Then
Price = PackageC * Nonprofit
lblTotal.Text = Price.ToString(\"C2\")
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
End Class


