in C# joes automotive performs the following routine maintenece services: ?oil c
ID: 3573924 • Letter: I
Question
in C#
joes automotive performs the following routine maintenece services:
?oil changes $26, lube job $18, radiator flush $30, transmission flush $80, inspection $15, ,muffler replacement 100, tire rotation 20, joe also performs other noroutine services and charges for parts and labor $20 per hour. create an application that displays the total for a customers visit to joes the form should resemble the one shown. there are other parts.
the application should have the following value return methods:
?oilLubeCharges - returns the total charges for an oil change and/or lube job, if any also adds up the oil type.
?flush charges - returns the total charges for a radiator flush or transmission flush if any
?Misc charge- returns the total charges for an inspection, muffler replacement, and/or tire rotation
?tax charges - returns the amount of sales tax 6% and is charged only on parts. if the customer purchases services only , no sales tax is charged
total charches- returns the total charges
?
Explanation / Answer
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace JoesAutomotive
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void exitButton_Click(object sender, EventArgs e)
{
this.Close();
}
private void calculateButton_Click_1(object sender, EventArgs e)
{
double oil = 0, lube = 0, radiator = 0, trans = 0, inspection = 0; double muffler = 0,tire = 0;
if (oilCheckBox.Checked == true)
{
oil = 26;
}
if (lubeCheckBox.Checked == true)
{
lube = 18;
}
if (radiatorCheckBox.Checked == true)
{
radiator = 30;
}
if (tranCheckBox.Checked == true)
{
trans = 80;
}
if (inspectionCheckBox.Checked == true)
{
inspection = 15;
}
if (replaceCheckBox.Checked == true)
{
muffler = 100;
}
if (tireCheckBox.Checked == true)
{
tire = 20;
}
double parts = double.Parse(partsTextBox.Text);
double labor = double.Parse(laborTextBox.Text);
double oillube = OilLubeCharges(oil, lube);
double flush = FlushCharges(radiator, trans);
double misc = MiscCharges(inspection, muffler, tire);
double other = OtherCharges(parts, labor);
double tax = TaxCharges(parts, labor, oillube, flush, misc, labor);
double total = TotalCharges (oillube, flush,misc, other, tax);
double services = oillube + flush + misc;
serviceTextBox.Text = services.ToString();
partTextBox.Text = other.ToString();
taxTextBox.Text = tax.ToString();
totalTextBox.Text = total.ToString();
}
private double OilLubeCharges(double oil, double lube)
{
return oil + lube;
}
private double FlushCharges(double radiator, double trans)
{
return radiator + trans;
}
private double MiscCharges(double inspection, double muffler, double tire)
{
return inspection + muffler + tire;
}
private double OtherCharges(double parts, double labor)
{
return parts + labor;
}
private double TaxCharges(double parts, double labor, double oillube, double flush, double misc, double other)
{
if (parts != 0 && labor != 0 && (oillube != 0
&& flush != 0 && misc != 0 && other != 0))
{
return (0.06 * parts);
}
else
return 0;
}
private double TotalCharges(double oillube, double flush, double misc, double other, double tax)
{
return oillube + flush + misc + other + tax;
}
private void clearButton_Click(object sender, EventArgs e)
{
ClearOilLube();
ClearFlushes();
ClearMisc();
ClearOther();
ClearFees();
}
private void ClearOilLube()
{
if (oilCheckBox.Checked == true)
{
oilCheckBox.Checked = false;
}
if (lubeCheckBox.Checked == true)
{
lubeCheckBox.Checked = false;
}
}
private void ClearFlushes()
{
if (radiatorCheckBox.Checked == true)
{
radiatorCheckBox.Checked = false;
}
if (tranCheckBox.Checked == true)
{
tranCheckBox.Checked = false;
}
}
private void ClearMisc()
{
if (inspectionCheckBox.Checked == true)
{
inspectionCheckBox.Checked = false;
}
if (replaceCheckBox.Checked == true)
{
replaceCheckBox.Checked = false;
}
if (tireCheckBox.Checked == true)
{
tireCheckBox.Checked = false;
}
}
private void ClearOther()
{
partsTextBox.Text = null;
laborTextBox.Text = null;
}
private void ClearFees()
{
serviceTextBox.Text = null;
partTextBox.Text = null;
taxTextBox.Text = null;
totalTextBox.Text = null;
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.