In: Computer Science
how can i get the code for this problem in visual
basic? Create a Windows Forms applications called ISP (Internet
Service Provider) Project. You must enter the number of hours for
the month and select your desire ISP package. An ISP has three
different subscription packages for it's customers:
Package A: For $9.95 per month 10 hours of access are
provided. Additional hours are $2 per hours.
Package B: For $13.95 per month 20 hours of access are provided.
Additional hours are $1 per hours.
Package C: For $19.95 per month unlimited access is
provided.
The program should also calculates and display the
amount of money Package A customers would save if they purchased
Package B or C, and the amount of money Package B customers would
save if they purchase Package C. If there would be no savings, no
message should be displayed.
thank you
can the options be display without using a radio button for the choose
Dear Student ,
As per the requirement submitted above , kindly find the below solution.
Here a new Windows Forms Application in VB is created using Visual Studio 2017 with name "VB_InternetServiceProvider".This application contains a form with name "Form1.vb".Below are the files associated with form1.
1.Form1.vb[Design]
2.Form1.vb
Public Class Form1 'Calculate button click
Private Sub btnCalculate_Click(sender As Object, e As EventArgs)
Handles btnCalculate.Click
'declaring variables
'taking hours entered by user
Dim hours As Double = Double.Parse(txtNumHours.Text)
Dim packageACost As Double
Dim packageBCost As Double
Dim cost As Double 'variable to store cost
'taking selected package
Dim package As String = cmbPackage.SelectedItem.ToString()
'checking which package is selected
If package = "Package A" Then
'calculate package A cost
packageACost = 9.95 + (hours - 10) * 2
'package B cost
Dim B As Double = 20 + (hours - 20) * 1
Dim saveCost As Double 'variable to store package save cost
saveCost = packageACost - B
If saveCost > 0 Then
'display package A cost on label
lblDetails.Text = "Package A cost $" &
packageACost.ToString("0.00") & Environment.NewLine & "For
package B " & saveCost & " must be saved " &
Environment.NewLine & "For Package C " & (packageACost -
19.95).ToString("0.00") & " must be saved"
Else
'display package A cost on label
lblDetails.Text = "Package A cost $" &
packageACost.ToString("0.00") & Environment.NewLine & "For
Package C " & (packageACost - 19.95).ToString("0.00") & "
must be saved"
End If
ElseIf package = "Package B" Then
'calculate package B cost
packageBCost = 20 + (hours - 20) * 1
'display package A cost on label
lblDetails.Text = "Package B cost $" &
packageBCost.ToString("0.00") & Environment.NewLine & "For
Package C " & (packageBCost - 19.95).ToString("0.00") & "
must be saved"
Else
'display package C cost on label
lblDetails.Text = "Package C cost for unlimited access is
$19.95"
End If
End Sub
End Class
======================================================
Output : Run application using F5 and will get the screen as shown below
Screen 1 :
Screen 2:When package A is selected
Screen 3:When package B is selected
Screen 4:When package C is selected
NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.