Question

Need the answer in CSharp programming not java.

Joe’s Automotive
Joe’s Automotive performs the following routine maintenance services:
• Oil change—$26.00
• Lube job—$18.00
• Radiator flush—$30.00
• Transmission flush—$80.00
• Inspection—$15.00
• Muffler replacement—$100.00
• Tire rotation—$20.00
Joe also performs other nonroutine services and charges for parts and labor ($20 per
hour). Create an application that displays the total for a customer’s visit to Joe’s.
The form should resemble the one shown in Figure 6-28 .
Figure 6-28 Automotive form

Figure 6-28 Automotive form Automotive Oil & Lube Flushes Oil hange ($26.00) Radiator Flush ($30.00) □ Lube Job ($18.00) □ TrThe application should have the following value-returning methods:
• OilLubeCharges —Returns the total charges for an oil change and/or a lube
job, if any.
• FlushCharges —Returns the total charges for a radiator flush and/or a transmission
flush, if any.
• MiscCharges —Returns the total charges for an inspection, muffler replacement,
and/or a tire rotation, if any.
• OtherCharges —Returns the total charges for other services (parts and labor),
if any.
• TaxCharges —Returns the amount of sales tax, if any. Sales tax is 6% and is
charged only on parts. If the customer purchases services only, no sales tax is
charged.
• TotalCharges —Returns the total charges.
The application should have the following void methods, called when the user
clicks the Clear button:
• ClearOilLube —Clears the check boxes for oil change and lube job.
• ClearFlushes —Clears the check boxes for radiator flush and transmission
flush.
• ClearMisc —Clears the check boxes for inspection, muffler replacement, and
tire rotation.
• ClearOther —Clears the text boxes for parts and labor.
• ClearFees —Clears the labels that display the labels in the section marked Summary
.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Below is the solution:

code:

using System;
using System.Windows.Forms;

namespace AutomotiveForm
{
    public partial class frmMain : Form
    {
        // Declare constant variables with value that cnnot change
        const decimal OIL_CHANGE = 26.00m;
        const decimal LUBE_JOB = 18.00m;
        const decimal RADIATOR_FLUSH = 30.00m;
        const decimal TRANSMISSION_FLUSH = 80.00m;
        const decimal INSPECTION = 15.00m;
        const decimal REPLACE_MUFFLER = 100.00m;
        const decimal TIRE_ROTATION = 20.00m;
        const decimal TAX = 0.06m; //6% tax
        private decimal total = 0m; //total value to 0 initialize
        decimal serviceslabor;
        decimal parts;
        decimal finaltax;
        decimal fees;

        public frmMain()
        {
            InitializeComponent();
        }

        //checked event for the oilchangeCheckbox that will add the total
        private void oilchangeCheckbox_CheckedChanged(object sender, EventArgs e)
        {
            total += OIL_CHANGE;
        }
        //checked event for the lubejobCheckbox that will add the total
        private void lubejobCheckbox_CheckedChanged(object sender, EventArgs e)
        {
            total += LUBE_JOB;
        }
        //checked event for the radiatorflushCheckbox that will add the total
        private void radiatorflushCheckbox_CheckedChanged(object sender, EventArgs e)
        {
            total += RADIATOR_FLUSH;
        }
        //checked event for the transmissionflushCheckbox that will add the total
        private void transmissionflushCheckbox_CheckedChanged(object sender, EventArgs e)
        {
            total += TRANSMISSION_FLUSH;
        }
        //checked event for the inspectionCheckbox that will add the total
        private void inspectionCheckbox_CheckedChanged(object sender, EventArgs e)
        {
            total += INSPECTION;
        }
        //checked event for the replacemufferCheckbox that will add the total
        private void replacemufferCheckbox_CheckedChanged(object sender, EventArgs e)
        {
            total += REPLACE_MUFFLER;
        }
        //checked event for the tirerotationCheckbox that will add the total
        private void tirerotationCheckbox_CheckedChanged(object sender, EventArgs e)
        {
            total += TIRE_ROTATION;
        }
        //total button event that will calulate the total, tax,
        private void totalButton_Click(object sender, EventArgs e)
        {
            serviceslabor = decimal.Parse(laborTextbox.Text) + total;
            parts = decimal.Parse(partsTextbox.Text);
            finaltax = TAX * parts;
            MessageBox.Show(finaltax.ToString());
            fees = total + parts + finaltax + serviceslabor;
            lblserviceslabor.Text = serviceslabor.ToString("n2");
            lblParts.Text = parts.ToString("n2");
            lblTax.Text = finaltax.ToString("n2");
            lblTotalFees.Text = fees.ToString("n2");
        }
        //close butto event
        private void exitButton_Click(object sender, EventArgs e)
        {
            this.Close(); //close the form
        }
        //clear button event
        private void clearButton_Click(object sender, EventArgs e)
        {
            //clears all the label, textbox, and the unchech the checkbox
            total = 0m; //set the total to 0
            lblserviceslabor.Text = String.Empty;
            lblParts.Text = String.Empty;
            lblTax.Text = String.Empty;
            lblTotalFees.Text = String.Empty;
            oilchangeCheckbox.Checked = false;
            lubejobCheckbox.Checked = false;
            radiatorflushCheckbox.Checked = false;
            transmissionflushCheckbox.Checked = false;
            inspectionCheckbox.Checked = false;
            replacemufferCheckbox.Checked = false;
            tirerotationCheckbox.Checked = false;
        }
    }
}

output:

Joes Automotive Oil and Lube Flushes Oil Change ($26.00) Lube Job ($18.00) Radiator Flush ($30.00) Transmission Flush ($80.0

Add a comment
Know the answer?
Add Answer to:
Joe’s Automotive Joe’s Automotive performs the following routine maintenance services: • Oil chan...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT