Question

6. Joe's Automotive Joe's Automotive performs the following routine maintenance services: • Oil change—$26.00 • Lube...

6. 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 for labor ($20 per hour). For that allow Joe to enter the number of hours. Also, the cost of parts if applicable. The customer may ask for more than one service.

Create a GUI application that displays the total for a customer's visit to Joe's.

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

Answer:-

The below is the required source code for the given problem

Code:-

public class Service extends JPanel

{

public final double OIL_CHANGE = 26.00;

public final double LUBE_JOB = 18.00;

public final double RADIATOR_FLUSH = 30.00;

public final double TRANSMISSION_FLUSH = 80.00;

public final double INSPECTION = 15.00;

public final double MUFFLER_REPLACEMENT = 100.00;

public final double TIRE_ROTATION = 20.00;

private JTextField calcTextField;

private JCheckBox Oil_change;

private JCheckBox Lube_job;

private JCheckBox Radiator_flush;

private JCheckBox Transmission_flush;

private JCheckBox Inspection;

private JCheckBox Muffler_replacement;

private JCheckBox Tire_rotation;

public Service()

{

setLayout(new GridLayout(7,1 ));

Oil_change = new JCheckBox("Oil Change ($26.00)");

Lube_job = new JCheckBox("Lube Job ($18.00)");

Radiator_flush = new JCheckBox("Radiator Flush ($30.00)");

Transmission_flush = new JCheckBox("Transmission Flush ($80.00)");

Inspection = new JCheckBox("Inspection ($50.00)");

Muffler_replacement = new JCheckBox("Muffler Replacement ($100.00)");

Tire_rotation = new JCheckBox("Tire Rotation ($20.00)");

setBorder(BorderFactory.createTitledBo… Services"));

add(Oil_change);

add(Lube_job);

add(Radiator_flush);

add(Transmission_flush);

add(Inspection);

add(Muffler_replacement);

add(Tire_rotation);

public double actionCalculate()

{

double total = 0;

if(Oil_change.isSelected())

total = total + OIL_CHANGE;

if(Lube_job.isSelected())

total = total + LUBE_JOB;

if(Radiator_flush.isSelected())

total = total + RADIATOR_FLUSH ;

if(Transmission_flush.isSelected())

total = total + TRANSMISSION_FLUSH;

if(Inspection.isSelected())

total = total + INSPECTION;

if(Muffler_replacement.isSelected())

total = total + MUFFLER_REPLACEMENT;

if(Tire_rotation.isSelected())

total = total + TIRE_ROTATION;

return total;

}

}

//This for NonRoutine Services

public class NonService extends JPanel

{

public final double perHourCharge = 20.00;

private JLabel partsLabel;

private JLabel laborLabel;

private JTextField partsTextField;

private JTextField laborTextField;

private JPanel panel;

public NonService()

{

partsLabel = new JLabel("Parts Charges:");

laborLabel = new JLabel("Hours of Labor:");

partsTextField = new JTextField(10);

laborTextField = new JTextField(10);

setBorder(BorderFactory.createTitledBo… services"));

add(partsLabel);

add(partsTextField);

add(laborLabel);

add(laborTextField);

panel = new JPanel();

panel.setLayout(new GridLayout(3,2));

setLayout(new GridLayout(2, 2));

}

}

public class CalculatorGUI extends JFrame

{

private Service sc;

private NonService ns;

private JPanel buttonPanel;

private JButton calcButton;

private JButton exitButton;

public CalculatorGUI()

{

super("Joe's Automotive");

setLocationRelativeTo(null);

setDefaultCloseOperation(JFrame.EXIT_O…

setLayout(new BorderLayout());

sc = new Service();

ns = new NonService();

buildButtonPanel();

add(sc, BorderLayout.NORTH);

add(ns, BorderLayout.SOUTH);

pack();

setVisible(true);

}

private void buildButtonPanel()

{

buttonPanel.add(calcButton);

buttonPanel.add(exitButton);

}

private class CalcButtonListener implements ActionListener

{

public void actionPerformed(ActionEvent e)

{

double total;

total = sc.actionCalculate() +ns.getNonroutineServicesCost();

DecimalFormat dollar = new DecimalFormat("0.00");

JOptionPane.showMessageDialog(null, "Total: $" +dollar.format(total) );

}

}

private class ExitButtonListener implements ActionListener

{

public void actionPerformed(ActionEvent e)

{

System.exit(0);

}

}

public static void main(String args[])

{

new CalculatorG

If you find difficulty to understand the code, please let me know in comments tab below, Then I will provide another code or else i will any modifications in the present code. Hope it will helps you. Please give Thumbs Up!! Thank you for posting the question, All the best.

Add a comment
Know the answer?
Add Answer to:
6. Joe's Automotive Joe's Automotive performs the following routine maintenance services: • Oil change—$26.00 • Lube...
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
  • Joe’s Automotive Joe’s Automotive performs the following routine maintenance services: • Oil chan...

    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...

  • I need help creating a code for the problem in Python. Joe's Automotive Joe's Automotive performs the following routine maintenance services: Oil change-$30.00 . Lube job-$20.00 Radiator flus...

    I need help creating a code for the problem in Python. Joe's Automotive Joe's Automotive performs the following routine maintenance services: Oil change-$30.00 . Lube job-$20.00 Radiator flush-$40.00 Transmission flush-$100.00 Inspection-$35.00 Muffler replacement-$200.00 Tire rotation- $20.00 Write a GUI program with check buttons that allow the user to select any or all of these services. When the user clicks a button, the total charges should be displayed Joe's Automotive Joe's Automotive performs the following routine maintenance services: Oil change-$30.00 ....

  • Lab Chapter 12 Vinnie's Auto Shop performs the following routine maintenance services: • Oil change: $35.00...

    Lab Chapter 12 Vinnie's Auto Shop performs the following routine maintenance services: • Oil change: $35.00 • Lube job: $25 • Battery replacement: $80 • Tire rotation: $20 Vinnie also performs other nonroutine services and charges for parts and for labor ($60 per hour). Using JavaFX, create a GUI application that buttons for the above list of services and textfields/buttons for parts and labor. As the user selects buttons, a total amount is to be displayed Grading Criteria • Documentation...

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