Hello, I am trying to figure out a form for a car maintenance service. I am using 5 groupboxes. In the first groupbox called Oil and Lube, I have 2 checkboxes, one for oil which is $26.00 and another one for a Lube job for $18.00. In the second groupbox called Flushes, I have 2 checkboxes: one for Radiator Flush for $30.00 and another for Transmission Flush for $80.00. In the third groupbox, called Misc, I have 3 checkboxes, one for Inspection $15.00, another for Replace Muffler for $100.00, and one for Tire Rotation for $20.00. In the fourth groupbox called Other Services, I have 2 textboxes: part and labor. In the final groupbox called Total Fees, I have 4 labels: Services &Labor, Parts, Tax (on parts) and Total Fees. There is also a calculate total button to total up each of these. The car maintenance company performs nonroutine services and charges for parts and labor ($20 per hour) Also, tax is 6% and only charged for parts and not services.
The problems that I’m having include:
-Figuring out how to set up the code for the 2 textboxes. (I am confused as to what exactly is supposed to go inside of them.) (number of parts * 20??)
-Setting up the code for the 2 labels (Services&Labor and Parts) in the total fees groupbox.
-Making a function for TaxCharges, OtherCharges, and TotalCharges.
I have done as much as I could. If someone could guide me in the right direction, it would be much appreciated!! Thanks everyone!!
CODE
Public Class Form1
Const DecTAX_RATE As Decimal = 0.06D
Private Sub btnCalculateTotal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculateTotal.Click
Dim decServiceLabor As Decimal
Dim decParts As Decimal
Dim decTax As Decimal
Dim decTotal As Decimal
decTotal = OilLubeCost() + FlushesCost() + MiscCost() + OtherServicesCost()
decTax = txtPart.Text * DecTAX_RATE
lblServiceTotal.Text = FormatCurrency(decServiceLabor)
lblPartsTotal.Text = FormatCurrency(decParts)
lblTaxTotal.Text = FormatCurrency(decTax)
lblTotalFees.Text = FormatCurrency(decTotal)
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
ClearOilLube()
ClearFlushes()
ClearMisc()
ClearOther()
ClearFees()
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Function OilLubeCost() As Decimal
Dim decCostofOilLube As Decimal = 0
If chkOil.Checked = True Then
decCostofOilLube += 26D
End If
If chkLube.Checked = True Then
decCostofOilLube += 18D
End If
Return decCostofOilLube
End Function
Function FlushesCost() As Decimal
Dim decCostofFlush As Decimal = 0
If chkRadiator.Checked = True Then
decCostofFlush += 30D
End If
If chkTransmission.Checked = True Then
decCostofFlush += 80D
End If
Return decCostofFlush
End Function
Function MiscCost() As Decimal
Dim decCostofMisc As Decimal = 0
If chkInspection.Checked = True Then
decCostofMisc += 15D
End If
If chkMuffler.Checked = True Then
decCostofMisc += 100D
End If
If chkTire.Checked = True Then
decCostofMisc += 20D
End If
Return decCostofMisc
End Function
Function OtherServicesCost() As Decimal
Dim decCostofOtherServices As Decimal = 0
End Function
Function CalcTax(ByVal decAmount As Decimal) As Decimal
Return decAmount * DecTAX_RATE
End Function
Function TotalCharges()
End Function
Private Sub ClearOilLube()
chkOil.Checked = False
End Sub
Sub ClearFlushes()
chkRadiator.Checked = False
chkTransmission.Checked = False
End Sub
Sub ClearMisc()
chkInspection.Checked = False
chkMuffler.Checked = False
chkTire.Checked = False
End Sub
Sub ClearOther()
txtPart.Clear()
txtLabor.Clear()
End Sub
Sub ClearFees()
lblServiceTotal.Text = ""
lblPartsTotal.Text = ""
lblTaxTotal.Text = ""
lblTotalFees.Text = ""
End Sub
End Class