Explanation of Solution
Program
Public Class frmMain
'Declaring variables of type double and initializing with values
'variable twin
Dim twin As Double = 39.99
'variable full
Dim full As Double = 49.99
'variable queen
Dim queen As Double = 49.99
'variable king
Dim king As Double = 69.99
'variable totalCost
Dim totalCost As Double = 0
'variable shippingFee
Dim shippingFee As Double
'calculating total cost after clicking on button
Private Sub btnCost_Click(sender As Object, e As EventArgs) Handles btnCost.Click
'displaying total cost in textbox and Math.Round() is used to round the totalcost to two decimal places
txtCost.Text = String.Format("$" + Math.Round((totalCost + shippingFee), 2).ToString())
End Sub
'exit button click
Private Sub btnExit_Click (sender As Object, e As EventArgs) Handles btnExit.Click
Application.Exit()
End Sub
'checkbox CheckedChanged() event
Private Sub chkpickup_CheckedChanged(sender As Object, e As EventArgs) Handles chkpickup.CheckedChanged
'if checkbox is checked then
If (chkpickup.Checked = True) Then
'assign the shipping fee to the variable shippingFee
shippingFee = 5
Else
'else shippingFee is zero
shippingFee = 0
End If
End Sub
'radio button twin CheckedChanged() event
Private Sub rbtTwin_CheckedChanged(sender As Object, e As EventArgs) Handles rbtTwin.CheckedChanged
'if radio button is changed the clear values from textbox
txtCost.Text = ""
If (rbtTwin...
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Programming with Microsoft Visual Basic 2017
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,