Menu

[Solved]Java Calculate Jbutton Clicked Use Assessment Home Value Two Tax Rates Calculate School Co Q37207372

JAVA- When the calculate JButton is clicked, use theAssessment Home Value and the two Tax Rates to calculate the Schooland County Taxes as well as the Total Taxes. When the exit JButtonis clicked, the program should shut down. All monetary amountsshould be displayed.

Process- sample JButtons for mouse clicks

Input- if the exit JButton isclicked​​​​​​​

Output- close the window​​​​​​​

Input- if the calculate JButton isclicked​​​​​​​

Input- assessment values and taxrates​​​​​​​

Process- calculate school, county and total taxvalues

Output- tax values to be displayed​​​​​​​

using lines such as – ExitHandler ebHandler = newExitHandler();​​​​​​​

exit.addActionListener(ebHandler);​​​​​​​

double assessD =Double.parseDouble(assessTF.getText());​​​​​​​

  totaltaxTF.setText(“”+ String.format(“%.2f”,totaltaxD));

Posted code has nonworking buttons

import javax.swing.*;
import java.awt.Container;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

public class PropertyTax extends JFrame {
private static final int WIDTH = 400, HEIGHT = 300;

public PropertyTax() {

  
JLabel assessL = new JLabel(“Assessment Home Value”,SwingConstants.RIGHT);
JTextField assessTFHome = new JTextField(10);
JLabel assessLSchool = new JLabel(“Decimal Value of School TaxRate”, SwingConstants.RIGHT);
JTextField assessTFSchool = new JTextField(10);
JLabel assessLCounty = new JLabel(“Decimal Value of County TaxRate”, SwingConstants.RIGHT);
JTextField assessTFCounty = new JTextField(10);
JLabel assessLSchoolTax = new JLabel(“School Taxes”,SwingConstants.RIGHT);
JTextField assessTFSchoolTax = new JTextField(10);
JLabel assessLCountyTax = new JLabel(“County Taxes”,SwingConstants.RIGHT);
JTextField assessTFCountyTax = new JTextField(10);
JLabel assessLTotalTax = new JLabel(“Total Taxes”,SwingConstants.RIGHT);
JTextField assessTFTotalTax = new JTextField(10);
JButton exit = new JButton(“Exit”);
   JButton calculate = new JButton(“Calculate”);
   this.setLayout(new GridLayout(7, 2));
this.add(assessL);
this.add(assessTFHome);
this.add(assessLSchool);
this.add(assessTFSchool);
this.add(assessLCounty);
this.add(assessTFCounty);
this.add(assessLSchoolTax);
this.add(assessTFSchoolTax);
this.add(assessLCountyTax);
this.add(assessTFCountyTax);
this.add(assessLTotalTax);
this.add(assessTFTotalTax);
this.add(exit);
   this.add(calculate);
this.setTitle(“Calculation of Property Taxes”);
this.setSize(WIDTH, HEIGHT);
this.setVisible(true);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.show();
      
   pane.add(assessL);

} // end of the constructor method

public static void main(String[] args) {

new PropertyTax();

}
}

Expert Answer


Answer to JAVA- When the calculate JButton is clicked, use the Assessment Home Value and the two Tax Rates to calculate the School… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *