I keep getting a "cannot resolve symbol" error message for this line of code: if (maritalStatus==s) Here is the program. I'm trying to allow a user to enter income and S or M for their marital status. Based upon this, I have to calculate the tax return.
I'm also not sure how to error check to be sure the user enters only an S or M.
public class Tax extends JApplet implements ActionListener {
double tax; char maritalStatus;
JLabel title = new JLabel("Tax Calculator"); JLabel incomePrompt = new JLabel("Enter Income:"); JLabel statusPrompt = new JLabel("Enter S for Single, M for Married:");
JTextField incomeInput = new JTextField(10); JTextField statusInput = new JTextField(1);
JButton computeButton = new JButton("Compute");
JLabel incomeLabel = new JLabel(" ", SwingConstants.CENTER); JLabel statusLabel = new JLabel(" ", SwingConstants.CENTER); JLabel taxRateLabel = new JLabel(" ", SwingConstants.CENTER); JLabel taxAmountLabel = new JLabel(" ", SwingConstants.CENTER);
TaxReturn calc = new TaxReturn();
public void init() { Container con = getContentPane(); con.setLayout(null);
I just worked on this and changed it a bit. Now I need the following help. I can't get the right marital status to print. I also am not sure how to put in error checking to make sure only positive numbers are entered for the income, and only 'm' or 's' is entered for the marital status.
public class Tax extends JApplet implements ActionListener {
double tax; double income; char maritalStatus;
JLabel title = new JLabel("Tax Calculator"); JLabel incomePrompt = new JLabel("Enter Income:"); JLabel statusPrompt = new JLabel("Enter S for Single, M for Married:");
JTextField incomeInput = new JTextField(10); JTextField statusInput = new JTextField(1);
JButton computeButton = new JButton("Compute");
JLabel incomeLabel = new JLabel(" ", SwingConstants.CENTER); JLabel statusLabel = new JLabel(" ", SwingConstants.CENTER); JLabel taxAmountLabel = new JLabel(" ", SwingConstants.CENTER);
TaxReturn calc = new TaxReturn();
public void init() {
Container con = getContentPane(); con.setLayout(null);