Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Property Tax A country collects property taxes on the assessment value of proper

ID: 3655472 • Letter: P

Question

Property Tax A country collects property taxes on the assessment value of property, which is 60 percent of the property's actual value. If an acre of land is valued at $10,000, its assessment value is $6,000. The property tax is then $0.64 for each $100 of the assessment value. The tax for the acre assessed at $6,000 will be $38.40. Design a GUI program that displays the assessment value and property tax when a user enters the actual value of a property. Draw the GUI screen you will use in this program. Draw the flowchart and write the pseudocode for the logic need in this program.

Explanation / Answer

//Some lines of code could not fit into one line. So please put them in one line when you copy and paste this //code for checking.

//made using java 6. It can accept numbers with commas.

//code :

 

import javax.swing.*;
import java.awt.event.*;


public class Tax
{
  public static void main(String[] args)
  {
    JFrame frame = new JFrame("property taxes calculator");
    JButton button = new JButton("Click to enter the property's actual value");
    button.addActionListener(new ActionListener()
    {
        public void actionPerformed(ActionEvent ae)
        {
            String str = JOptionPane.showInputDialog(null, "Enter the actual value : ", "property's actual value", 1);
            if(str != null)
            {
                String num = str.replaceAll(",","");
                Float val = 0.0f;
                if(!str.equals(""))
                {
                 val = Float.valueOf(num);
                }
                float aValue = 0.6f * val; //assessment value
                float tax = (aValue * 0.64f)/100 ;
               
                JOptionPane.showMessageDialog(null, "Actual value of property : " + val + " >Assessment value is : " + aValue + " >Tax is : " + tax , "Your results", 1);
            }
            else
            JOptionPane.showMessageDialog(null, "Bye, have a nice day !", "Goodbye !", 1);
        }
    });
   
  JPanel panel = new JPanel();
  panel.add(button);
  frame.add(panel);
  frame.setSize(400, 200);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setVisible(true);
  }
}