2022-11-16 17:48:22 -06:00

83 lines
2.4 KiB
C#
Executable File

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);
return total;
}
private decimal TaxCharges()
{
decimal total = 0m;
total = OilLubeChanges(total);
total = MiscCharges(total);
decimal tax = total * 0.06m;
return tax;
}
private void calculateButton_Click(object sender, EventArgs e)
{
decimal total = TotalCharges();
decimal tax = TaxCharges();
// Set textboxes
totalFeesTextBox.Text = total.ToString("c");
taxTextBox.Text = tax.ToString("c");
}
}
}