using System.CodeDom; namespace JoesAutomotive_CalebFontenot { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private decimal OilLubeChanges(decimal total) { // Check if the appropiate check boxes are checked, and if they are, add their sums to total. if (oilChangeCheckBox.Checked) { total += 26.00m; } if (lubeJobCheckBox.Checked) { total += 16.00m; } return total; } private decimal FlushCharges(decimal total) { // Check if the appropiate check boxes are checked, and if they are, add their sums to total. if (radiatorFlushCheckBox.Checked) { total += 30.00m; } if (transmissionFlushCheckBox.Checked) { total += 80.00m; } return total; } private decimal MiscCharges(decimal total) { // Check if the appropiate check boxes are checked, and if they are, add their sums to total. if (inspectionCheckBox.Checked) { total += 30.00m; } if (replaceMufflerCheckBox.Checked) { total += 80.00m; } if (tireRotationCheckBox.Checked) { total += 20.00m; } return total; } private decimal TotalCharges() { decimal total = 0m; total = OilLubeChanges(total); total = FlushCharges(total); total = MiscCharges(total); total += OtherCharges(); return total; } private decimal TaxCharges() { decimal.TryParse(partsInputTextBox.Text, out decimal total); decimal tax = total * 0.06m; return tax; } private decimal OtherCharges() { decimal partsCost, laborCost; decimal.TryParse(partsInputTextBox.Text, out partsCost); decimal.TryParse(laborInputTextBox.Text, out laborCost); return partsCost + laborCost; } private void calculateButton_Click(object sender, EventArgs e) { decimal total = TotalCharges(); decimal tax = TaxCharges(); decimal outputOtherCharges = OtherCharges(); // Set textboxes servicesAndLaborTextBox.Text = total.ToString("c"); totalFeesTextBox.Text = (total + tax).ToString("c"); taxTextBox.Text = tax.ToString("c"); partsTextBox.Text = partsInputTextBox.Text; } private void exitButton_Click(object sender, EventArgs e) { Close(); } private void clearButton_Click(object sender, EventArgs e) { // Clear EVERYTHING servicesAndLaborTextBox.Text = ""; partsTextBox.Text = ""; partsInputTextBox.Text = ""; taxTextBox.Text = ""; totalFeesTextBox.Text = ""; laborInputTextBox.Text = ""; // Now for the checkboxes. oilChangeCheckBox.Checked = false; lubeJobCheckBox.Checked = false; radiatorFlushCheckBox.Checked = false; transmissionFlushCheckBox.Checked = false; inspectionCheckBox.Checked = false; replaceMufflerCheckBox.Checked = false; tireRotationCheckBox.Checked = false; } } }