I cant figure out what's wrong with my code. I need help on fixing it TG Automotive Problem for Visual Basic. Page 424.
I cant figure out what's wrong with my code. I need help on fixing it
TG Automotive Problem for Visual Basic. Page 424.
Public Class Form1
Private Sub btnCalc_Click(sender As Object, e As EventArgs) HandlesbtnCalc.Click
Dim Oil As Decimal
Dim Lube As Decimal
Dim RadFlush As Decimal
Dim TransFlush As Decimal
Dim Inspection As Decimal
Dim Muffler As Decimal
Dim Tire As Decimal
Dim Parts As Decimal
Dim Labor As Decimal
Dim totSrvcLabor As Decimal = CStr(totSrvcLabor)
Dim totParts As Decimal = CStr(totParts)
Dim totTax As Decimal = CStr(totTax)
Dim GrandTotal As Decimal = CStr(GrandTotal)
' Get the Parts Cost and Labor time in minutes.
Try
Parts = CStr(txtParts.Text)
Labor = CStr(txtLabor.Text)
End Try
Function ValidateInputFields(Parts, Labor) As Boolean
If Not Decimal.TryParse(txtParts.Text, Parts) Then
lblMessage.Text = "Parts input must be numeric"
Return False
End If
If Not Decimal.TryParse(txtLabor.Text, Labor) Then
lblMessage.Text = "Labor input must be numeric"
Return False
End If
' Verify that the two input values are valid numbers and neitheris less than zero.
' Calculate all oil and lube charges.
If chkOil.Checked Then
Oil = 36D
End If
If chkLube.Checked Then
Lube = 28D
End If
Function CalcOilLubeCharges(ByVal Oil, ByVal Lube) As Decimal
End Function
' Calculate radiator and transmission flush charges.
If chkRadFlush.Checked Then
RadFlush = 50D
End If
If chkTransFlush.Checked Then
TransFlush = 120D
End If
Function CalcFlushCharges(ByVal RadFlush, ByVal TransFlush) AsDecimal
End Function
' Calculate inspection, muffler, and tire rotation charges
If chkInspection.Checked Then
Inspection = 15D
End If
If chkMuffler.Checked Then
Muffler = 200D
End If
If chkTire.Checked Then
Tire = 20D
End If
Function CalcMisCharges(ByVal Inspection, ByVal Muffler, ByValTire) As Decimal
End Function
' Calculate and display the total of all charges including Laborand Services.
Function CalcSrvcLabor(ByVal CalcOilLubeCharges, BValCalcFlushCharges, ByVal CalcMiscCharges, ByVal Labor) AsDecimal
End Function
' Calculate and display the total of Parts.
totParts = Parts
' Calculate and display the Total Tax on Parts.
totTax = .06 * Parts
' Calculate the Grand Total.
Sub CalculateTotalCharges(CalcSrvcLabor, totParts, totTax)
End Sub
Private Sub btnClear_Click(sender As Object, e As EventArgs)Handles btnClear.Click
' Reset the oil change and lube job check boxes.
chkOil.Checked = False
chkLube.Checked = False
' Clear the radiator and transmission flush check boxes.
chkRadFlush.Checked = False
chkTransFlush.Checked = False
' Clear the inspection, muffler replacement, and tire rotationcheck boxes.
chkInspection.Checked = False
chkMuffler.Checked = False
chkTire.Checked = False
' Clear the parts and labor text boxes.
txtLabor.Clear()
txtParts.Clear()
' Clear the Services and Labor Totals, Parts Total, Tax, and TotalFees.
txtTotal.Text = String.Empty
txtTax.Text = String.Empty
txtPartsTotal.Text = String.Empty
txtSrvcLabor.Text = String.Empty
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) HandlesbtnExit.Click
' Exit the form.
Me.Close()
End Sub
End Class
Trending now
This is a popular solution!
Step by step
Solved in 2 steps