This code calculates the monthly cost of telephone service options. It checks if call waiting, call forwarding, or caller ID options are selected, increments a counter for each selected option, then uses a select case statement to set the cost based on the number of options: $3.50 for 1, $7 for 2, or $10.50 for 3 options. It then displays the total monthly cost by adding $25 to the option cost.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
32 views
Exercise 8
This code calculates the monthly cost of telephone service options. It checks if call waiting, call forwarding, or caller ID options are selected, increments a counter for each selected option, then uses a select case statement to set the cost based on the number of options: $3.50 for 1, $7 for 2, or $10.50 for 3 options. It then displays the total monthly cost by adding $25 to the option cost.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Exercise 8
Public Class Form1
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click Dim cost As Decimal Dim numOptions As Integer = 0 If chkCallWaiting.Checked = True Then numOptions += 1 End If If chkCallForwarding.Checked = True Then numOptions += 1 End If If chkCallerID.Checked = True Then numOptions += 1 End If Select Case numOptions Case 1 cost = 3.5 Case 2 cost = 2 * 3.5 Case 3 cost = 3 * 3.5 End Select Me.lblCost.Text = cost + 25 End Sub End Class