I am having trouble figuring out part b. Part b is important because the calculate button determines the entire problem, and I cannot figure out how to make it so it shows any text in the total due box. This is what I have for code so far, and none of it has 'errors', it just doesn't properly work. Public Class frmMain Private Function GetBusiness(ByVal dblConnections As Double) As Double ' Calculate the amount due. Dim dblAmountDue As Double dblAmountDue = 106.5 If dblConnections >= 10 Then dblAmountDue += 4 * (dblConnections - 10) End If Return dblAmountDue End Function Private Function GetResidential(ByVal dblChannels As Double) As Double ' Calculate the amount due. Dim dblAmountDue As Double dblAmountDue = 34.5 If dblChannels >= 1 Then dblAmountDue += 5 * (dblChannels - 1) End If Return dblAmountDue End Function Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load ' Populate lists. For intPremium As Integer = 0 To 20 ' Step 1 lstPremium.Items.Add(intPremium) Next intPremium lstPremium.SelectedIndex = 0 For intConnections As Integer = 0 To 100 ' Step 2 lstConnections.Items.Add(intConnections) Next intConnections lstConnections.SelectedIndex = 0 End Sub Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click Me.Close() End Sub Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click ' Display the amount due. Dim dblTotalDue As Double Dim dblPremium As Double Dim dblConnections As Double Dim dblChannels As Double Double.TryParse(txtTotalDue.Text, dblTotalDue) Double.TryParse(lstPremium.SelectedItem.ToString, dblPremium) Double.TryParse(lstConnections.SelectedItem.ToString, dblConnections) Dim dblAmountDue As Double ' Determine which radio button is selected and assign the fee. If radResidential.Checked = True Then dblAmountDue = 34.5 ElseIf dblChannels >= 1 Then dblAmountDue += 5 * (dblChannels - 1) ElseIf radBusiness.Checked = True Then dblAmountDue = 106.5 ElseIf dblConnections >= 10 Then dblAmountDue += 4 * (dblConnections - 10) End If End Sub Private Sub radBusiness_CheckedChanged(sender As Object, e As EventArgs) Handles radBusiness.CheckedChanged txtTotalDue.Text = String.Empty End Sub Private Sub radResidential_CheckedChanged(sender As Object, e As EventArgs) Handles radResidential.CheckedChanged txtTotalDue.Text = String.Empty End Sub Private Sub frmMain_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing ' Verify that the user wants to exit the application. Dim dlgButton As DialogResult dlgButton = MessageBox.Show("Do you want to exit?", "Chambers Sales", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) ' If the No button is selected, do not close the form. If dlgButton = DialogResult.No Then e.Cancel = True End If End Sub End Class
I am having trouble figuring out part b. Part b is important because the calculate button determines the entire problem, and I cannot figure out how to make it so it shows any text in the total due box. This is what I have for code so far, and none of it has 'errors', it just doesn't properly work. Public Class frmMain Private Function GetBusiness(ByVal dblConnections As Double) As Double ' Calculate the amount due. Dim dblAmountDue As Double dblAmountDue = 106.5 If dblConnections >= 10 Then dblAmountDue += 4 * (dblConnections - 10) End If Return dblAmountDue End Function Private Function GetResidential(ByVal dblChannels As Double) As Double ' Calculate the amount due. Dim dblAmountDue As Double dblAmountDue = 34.5 If dblChannels >= 1 Then dblAmountDue += 5 * (dblChannels - 1) End If Return dblAmountDue End Function Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load ' Populate lists. For intPremium As Integer = 0 To 20 ' Step 1 lstPremium.Items.Add(intPremium) Next intPremium lstPremium.SelectedIndex = 0 For intConnections As Integer = 0 To 100 ' Step 2 lstConnections.Items.Add(intConnections) Next intConnections lstConnections.SelectedIndex = 0 End Sub Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click Me.Close() End Sub Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click ' Display the amount due. Dim dblTotalDue As Double Dim dblPremium As Double Dim dblConnections As Double Dim dblChannels As Double Double.TryParse(txtTotalDue.Text, dblTotalDue) Double.TryParse(lstPremium.SelectedItem.ToString, dblPremium) Double.TryParse(lstConnections.SelectedItem.ToString, dblConnections) Dim dblAmountDue As Double ' Determine which radio button is selected and assign the fee. If radResidential.Checked = True Then dblAmountDue = 34.5 ElseIf dblChannels >= 1 Then dblAmountDue += 5 * (dblChannels - 1) ElseIf radBusiness.Checked = True Then dblAmountDue = 106.5 ElseIf dblConnections >= 10 Then dblAmountDue += 4 * (dblConnections - 10) End If End Sub Private Sub radBusiness_CheckedChanged(sender As Object, e As EventArgs) Handles radBusiness.CheckedChanged txtTotalDue.Text = String.Empty End Sub Private Sub radResidential_CheckedChanged(sender As Object, e As EventArgs) Handles radResidential.CheckedChanged txtTotalDue.Text = String.Empty End Sub Private Sub frmMain_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing ' Verify that the user wants to exit the application. Dim dlgButton As DialogResult dlgButton = MessageBox.Show("Do you want to exit?", "Chambers Sales", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) ' If the No button is selected, do not close the form. If dlgButton = DialogResult.No Then e.Cancel = True End If End Sub End Class
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
I am having trouble figuring out part b. Part b is important because the calculate button determines the entire problem, and I cannot figure out how to make it so it shows any text in the total due box. This is what I have for code so far, and none of it has 'errors', it just doesn't properly work.
Public Class frmMain
Private Function GetBusiness(ByVal dblConnections As Double) As Double
' Calculate the amount due.
Dim dblAmountDue As Double
dblAmountDue = 106.5
If dblConnections >= 10 Then
dblAmountDue += 4 * (dblConnections - 10)
End If
Return dblAmountDue
End Function
Private Function GetResidential(ByVal dblChannels As Double) As Double
' Calculate the amount due.
Dim dblAmountDue As Double
dblAmountDue = 34.5
If dblChannels >= 1 Then
dblAmountDue += 5 * (dblChannels - 1)
End If
Return dblAmountDue
End Function
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Populate lists.
For intPremium As Integer = 0 To 20 ' Step 1
lstPremium.Items.Add(intPremium)
Next intPremium
lstPremium.SelectedIndex = 0
For intConnections As Integer = 0 To 100 ' Step 2
lstConnections.Items.Add(intConnections)
Next intConnections
lstConnections.SelectedIndex = 0
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
' Display the amount due.
Dim dblTotalDue As Double
Dim dblPremium As Double
Dim dblConnections As Double
Dim dblChannels As Double
Double.TryParse(txtTotalDue.Text, dblTotalDue)
Double.TryParse(lstPremium.SelectedItem.ToString, dblPremium)
Double.TryParse(lstConnections.SelectedItem.ToString, dblConnections)
Dim dblAmountDue As Double
' Determine which radio button is selected and assign the fee.
If radResidential.Checked = True Then
dblAmountDue = 34.5
ElseIf dblChannels >= 1 Then
dblAmountDue += 5 * (dblChannels - 1)
ElseIf radBusiness.Checked = True Then
dblAmountDue = 106.5
ElseIf dblConnections >= 10 Then
dblAmountDue += 4 * (dblConnections - 10)
End If
End Sub
Private Sub radBusiness_CheckedChanged(sender As Object, e As EventArgs) Handles radBusiness.CheckedChanged
txtTotalDue.Text = String.Empty
End Sub
Private Sub radResidential_CheckedChanged(sender As Object, e As EventArgs) Handles radResidential.CheckedChanged
txtTotalDue.Text = String.Empty
End Sub
Private Sub frmMain_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
' Verify that the user wants to exit the application.
Dim dlgButton As DialogResult
dlgButton = MessageBox.Show("Do you want to exit?",
"Chambers Sales",
MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation)
' If the No button is selected, do not close the form.
If dlgButton = DialogResult.No Then
e.Cancel = True
End If
End Sub
End Class
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education