У меня есть вопрос о домашней работе, и я не знаю, что я делаю неправильно, есть много ошибок, которые я не знаю, как исправить. Это вопрос:
Автосервис предоставляет следующие услуги (всем нижеуказанным услугам присваивается значение):
- Замена масла
- Lube Job
- Промывка радиатора
- Трансмиссионный скрытый осмотр
- замена глушителя и
- Вращение шин
Создайте приложение, которое отображает общее количество посещений клиента. Это мой код:
Public Class Form1
'class level declerations
Const decTax_Rate As Decimal = 0.06D ' TaX on Parts only
Const decOilChange As Decimal = 26 ' cost of oil change
Const decLubeJob As Decimal = 18 ' cost for lube job
Const decRadiator As Decimal = 30 ' cost for Raditor Flush
Const decTransmission As Decimal = 80 ' cost of transmission work
Const decInspection As Decimal = 15 ' cost of inspection
Const decReplaceMuffler As Decimal = 100 'cost of replacing muffler
Const decRotateTire As Decimal = 20 'cost of rotating tire
End Class
Private Sub btnCalculate_Click(....) Handles btnCalculate.Click ( Error: Identify expected. I put in the following identifiers( Byval decpart as decimal and so on) but still underline the whole procedure as statement is not valid in a namespace)
' The procedure calculate the service total
Dim decPart As Decimal ' hold charges for parts
Dim decServiceLabor As Decimal ' hold charges for labor and other services
Dim decTaxCharges As Decimal ' hold sales tax on parts
Dim decTotalCharges As Decimal ' hold total charges
decServiceLabor = OilLubeCharges() + FlushCharges() + MiscCharges() + OtherCharges()
decPart = part1
decTaxCharges = CalcTax(decParts)
decTotalCharges = decOtherCharges + decTaxCharges
lblServiceString.Text = decServiceLabor.ToString("c")
lblParts.Text = decPart.ToString("c")
lblPartsTax.Text = decTax_Rate.ToString("c")
lblTotalFees.Text = decTotalCharges.ToString("c")
End Sub
Private Sub btnClear_Click(...) Handles btnClear.Click
' This procedur clears the controls to default values
ClearOilLube() ' Clear the check boxes for oil and Lube jobs
ClearFlushes() ' Clear the check boxes for radiation and transmission
ClearsMisc() ' Clear the check boxes for inspection muffler and tire
ClearOther() ' Clear the text boxes for parts and labor
ClearFees() ' Clear the summary lables
End Sub
Private Sub btnExit_Click(...) Handles btnExit.Click
' Close the form.
Me.Close()
End Sub
Function OilLubeCharges(ByVal decOilChange As Decimal) As Decimal
' This function returns the charges for an oil change and or lube job.
Dim decOilLube As Decimal = 0D
If chkOilChange.Checked = True Then
decOilLube += decOilChange
End If
If chkLubeJob.Checked = True Then
decOilLube += decLubeJob
End If
Return decOilLube
End Function
Function MiscCharges(ByVal decInspection As Decimal) As Decimal
'The function returns the total charges for an inspection, muffler replacement and/or a tire rotation
Dim decMisc As Decimal = 0D
If chkInspection.Checked = True Then
decMisc += decInspection
End If
If chkReplaceMuffler.Checked = True Then
decMisc += decReplaceMuffler
End If
If chkTireRotation.Checked = True Then
decMisc += decRotateTire
End If
Return decMisc
End Function
Function FlushCharges(ByVal decRadiator As Decimal) As Decimal
'This function return the total charges for a radiator flush and/or a tansmission flush
Dim decFlush As Decimal = 0D
If chkRadiatorFlush.Checked = True Then
decFlush += decRadiator
End If
If chkTrasmission.Checked = True Then
decFlush += decTransmission
End If
Return decFlush
End Function
Function Parts(ByVal decpart As Decimal) As Decimal
' To hold the parts sales
Dim decPart1 As Decimal
decPart1 += decpart
Return decPart1
End Function
Function CalcTax(ByVal decpart As Decimal) As Decimal
' This Function receives the sales part and returns the sale part tax.
Return decpart * decTax_Rate
End Function
Sub ResetOil()
' This procedure resets the oil and lube job.
chkOilChange.Checked = False
chkLubeJob.Checked = False
End Sub
Sub ResetMisc()
' This procedure resets the misc
chkInspection.Checked = False
chkReplaceMuffler.Checked = False
chkTireRotate.Checked = False
End Sub
Sub ResetFlushFluids()
' This procedure resets the flush
chkRadiatorFlush.Checked = False
chkTrasmission.Checked = False
End Sub
Sub ResetPrice()
' This procedure resets the price
lblServiceString.Text = String.Empty
lblParts.Text = String.Empty
lblPartsTax.Text = String.Empty
lblTotalFees.Text = String.Empty
End Sub
На самом деле все первые строки функций были подчеркнуты как недопустимые операторы пространства имен, и все процедуры нуждаются в идентификаторах даже после того, как я вставил Идентификацию. В форме класса не было ошибок.
Есть предложения?