where can I find the answers to the case studies or would anyone answer the \"wr
ID: 3675518 • Letter: W
Question
where can I find the answers to the case studies or would anyone answer the "write a function procedure to calculate and return the sales tax" part for me? My instructor wants me to rewrite this specific line of code as a return statement.
TaxDecimal = ((SalesPriceDecimal + AccTotalDecimal) * TAX_RATE_Decimal)
But for some reason my brain isn’t wrapping around this idea. Please help?
Here is my Current code for the Calculate button:
Option Strict On
Option Explicit On
Public Class AutoForm
'Declare the module-level constants.
Const STEREO_CHARGE_Decimal As Decimal = 425.76D
Const LEATHER_CHARGE_Decimal As Decimal = 987.41D
Const NAVIGATION_CHARGE_Decimal As Decimal = 1741.23D
Const PEARLIZED_CHARGE_Decimal As Decimal = 345.72D
Const DETAILING_CHARGE_Decimal As Decimal = 599.99D
Const TAX_RATE_Decimal As Decimal = 0.08D
Private Sub CalculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click, CalculateToolStripMenuItem1.Click
'Calculate price
Dim SalesPriceDecimal, AccTotalDecimal,
SubTotalDecimal, TaxDecimal, TotalDecimal,
AllowanceDecimal, AmountDueDecimal As Decimal
Dim MessageString As String
Try
'Convert the sales price
SalesPriceDecimal = Decimal.Parse(SalesPriceTextBox.Text)
Try
'If no data was entered into the trade-in text box, default the amount to zero
If TradeInTextBox.Text = "" Then
TradeInTextBox.Text = "0"
End If
'Convert the trade-in allowance
AllowanceDecimal = Decimal.Parse(TradeInTextBox.Text)
'Include the exterior finish charges.
If PearlizedRadioButton.Checked Then
AccTotalDecimal += PEARLIZED_CHARGE_Decimal
ElseIf CustomRadioButton.Checked Then
AccTotalDecimal += DETAILING_CHARGE_Decimal
End If
'Include the accessories charges.
If StereoCheck.Checked Then
AccTotalDecimal += STEREO_CHARGE_Decimal
End If
If LeatherCheckBox.Checked Then
AccTotalDecimal += LEATHER_CHARGE_Decimal
End If
If NavigationCheckBox.Checked Then
AccTotalDecimal += NAVIGATION_CHARGE_Decimal
End If
'Calculate the subtotal before tax
SubTotalDecimal = SalesPriceDecimal + AccTotalDecimal
'Calculate sales tax
TaxDecimal = ((SalesPriceDecimal + AccTotalDecimal) * TAX_RATE_Decimal)
'Calculate subtotal
TotalDecimal = (SalesPriceDecimal + AccTotalDecimal) + TaxDecimal
'Calculate amount due
AmountDueDecimal = TotalDecimal - AllowanceDecimal
'Display amounts in labels
SalesPriceTextBox.Text = SalesPriceDecimal.ToString("C")
AccessoriesAndFinishTextBox.Text = AccTotalDecimal.ToString("C")
SubTotalTextBox.Text = SubTotalDecimal.ToString("C")
SalesTaxTextBox.Text = TaxDecimal.ToString("C")
TotalTextBox.Text = TotalDecimal.ToString("C")
TradeInTextBox.Text = AllowanceDecimal.ToString("C")
AmountDueTextBox.Text = AmountDueDecimal.ToString("C")
Catch AllowanceException As FormatException
MessageString = "The trade-in amount must be numeric."
MessageBox.Show(MessageString, "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
With TradeInTextBox()
.Focus()
.SelectAll()
End With
End Try
Catch SalePriceException As FormatException
MessageString = "The sales price must be numeric."
MessageBox.Show(MessageString, "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
With SalesPriceTextBox()
.Focus()
.SelectAll()
End With
Catch AnyException As Exception
MessageBox.Show("Error: " & AnyException.Message)
End Try
End Sub
dify the rasen sluty project slwiy and a function procerdur redure I a fuetion proceslure to caleuiais anl esurm aetion procedure. Belet nChar m e w study projeet fn - Write a tunetion als ausers font and color chasgs to the - Apply the users font and colar chuoe ul oi your your choice. Menn Edit File Eile Calculate Clear Font color Shout ExitExplanation / Answer
Function string taxcal(Dim SalesPriceDecimal, dim AccTotalDecimal,dim TAX_RATE_Decimal)
string TaxDecimal
TaxDecimal = ((SalesPriceDecimal + AccTotalDecimal) * TAX_RATE_Decimal)
return taxDecimal
define it and pass values after calculating in program
end Function
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.