I have been trying to work on this calculator for a while and I need help. I'm getting "12" errors. I'm very new at this and I really need the help of someone that can please take the time to explain what I'm doing wrong. I would really appreciated.

/* 
 * Program: Mortgage Calculator with Graphical User Interface
 * Programs accepts user input in 3 text fields: Mortgage Amount, Mortgage Term, and Interest Rate.
 * User can calculate the monthly payment amount from a selection of the following:
 *              7 year loan at 5.35%
 *		15 year loan at 5.50%	 
 *		30 year loan at 5.75%	
 * The user can enter the new available choices and get the different loan amounts, the the balance and the monthly interest in an array.
 */

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.Double;
import java.text.DecimalFormat;
import javax.swing.event.*;
import java.text.*;
import java.util.*;
import javax.swing.border.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JApplet;


// Create MortgageCalculator class
public class MortgageCalc3 extends javax.swing.JApplet implements ActionListener {



// Radio Button Selection
    JPanel rowOne = new JPanel();
    JRadioButton rbOne = new JRadioButton("7 Years/5.35%", true);
    JRadioButton rbTwo = new JRadioButton("15 Years/5.5%", true);
    JRadioButton rbThree = new JRadioButton("30 Years/5.75%", true);

// Text Amount for Mortgage
    JPanel rowTwo = new JPanel();
    JLabel mortgageLabel = new JLabel("Mortgage Amount $", JLabel.LEFT);
    JTextField mortgageText = new JTextField(10);
    JLabel termLabel = new JLabel("Mortgage Term (Years)", JLabel.LEFT);
    JTextField termText = new JTextField(3);
    JLabel intRateLabel = new JLabel("Interest Rate (%)", JLabel.LEFT);
    JTextField intRateText = new JTextField(5);
    JLabel mPaymentLabel = new JLabel("Monthly Payment $", JLabel.LEFT);
    JTextField mPaymentText = new JTextField(10);

// Create buttons to calculate payment, amortizaton, and clear fields
    JPanel rowThree = new JPanel();
    JButton calculateButton = new JButton("CALCULATE");
    JButton clearButton = new JButton("CLEAR");
    JButton exitButton = new JButton("EXIT");

// Create Label for Text Box
    JPanel rowFour = new JPanel();
    JLabel paymentLabel = new JLabel("Payment #");
    JLabel balLabel = new JLabel(" Balance");
    JLabel ytdPrincLabel = new JLabel(" Principal");
    JLabel ytdIntLabel = new JLabel(" Interest");

// Display area
    JPanel rowFive = new JPanel(new FlowLayout());
    JTextArea textArea = new JTextArea(10, 31);
    JScrollPane scroll = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);



    public MortgageCalc3() {
        super("KARIN'S CALC");
        setSize(400, 485);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container pane = getContentPane();
        JScrollPane scroll1 = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        FlowLayout layout = new FlowLayout(FlowLayout.LEFT);
        pane.setLayout(layout);


// Add to the screen
        FlowLayout layout1 = new FlowLayout();
        rowOne.setLayout(layout1);

// Add Radio Button Group
        ButtonGroup btnGrp = new ButtonGroup();
        btnGrp.add(rbOne);
        btnGrp.add(rbTwo);
        btnGrp.add(rbThree);
        rowOne.add(rbOne);
        rowOne.add(rbTwo);
        rowOne.add(rbThree);
        pane.add(rowOne);

// Create a border around the radio buttons
        Border titledRadioBorder =
                BorderFactory.createTitledBorder("Make your selections");
        rowOne.setBorder(titledRadioBorder);

// Listeners
        rbOne.addActionListener(this);
        rbTwo.addActionListener(this);
        rbThree.addActionListener(this);



// Add Labels & Text Boxes
        GridLayout layout2 = new GridLayout(4, 1);
        rowTwo.setLayout(layout2);
        rowTwo.add(mortgageLabel);
        rowTwo.add(mortgageText);
        mortgageText.setText("200000");
        rowTwo.add(termLabel);
        rowTwo.add(termText);
        termText.setText("30");
        rowTwo.add(intRateLabel);
        rowTwo.add(intRateText);
        intRateText.setText("5.75");
        rowTwo.add(mPaymentLabel);
        rowTwo.add(mPaymentText);
        mPaymentText.setEnabled(false);
        pane.add(rowTwo);

// Add Buttons
        FlowLayout layout3 = new FlowLayout(FlowLayout.CENTER, 10, 10);
        rowThree.setLayout(layout3);
        rowThree.add(calculateButton);
        calculateButton.setBackground(Color.green);
        rowThree.add(clearButton);
        clearButton.setBackground(Color.white);
        rowThree.add(exitButton);
        exitButton.setBackground(Color.red);
        pane.add(rowThree);

// Listeners
        calculateButton.addActionListener(this);
        clearButton.addActionListener(this);
        exitButton.addActionListener(this);

// Add Text Box Label
        FlowLayout layout4 = new FlowLayout(FlowLayout.LEFT, 10, 10);
        rowFour.setLayout(layout4);
        rowFour.add(paymentLabel);
        rowFour.add(balLabel);
        rowFour.add(ytdPrincLabel);
        rowFour.add(ytdIntLabel);
        pane.add(rowFour);

// Add Text Box
        FlowLayout layout5 = new FlowLayout(FlowLayout.CENTER, 10, 10);
        rowFive.setLayout(layout5);
        rowFive.add(scroll1);
        pane.add(rowFive);

        setContentPane(pane);
        setVisible(true);
    }

    public static void main(String[] args) throws Exception {
        DecimalFormat dollarAmount = new DecimalFormat("#,###.00");
        DecimalFormat percentAmount = new DecimalFormat("##.##");

        MortgageCalc3 frame = new MortgageCalc3();
    }

    public void setResultValue() {
double monthlyPayment, monthlyInterest, denominator, numOfMonths, getMortgageAmount,MortgageInfo ;
   double[] annualInterests  = {5.35,5.5,5.75}; //Interest Array
   int[] numOfYears    = {7,15,30}; //Term Array
  

        double principal = Double.parseDouble(mortgageText.getText());
        double term = Double.parseDouble(termText.getText());
        double interest = Double.parseDouble(intRateText.getText());
	float paymentdue; 
	monthlyInterest = annualInterests[]/(12*100);
    	int totalNumOfMonths = numOfYears[]*12;

         int months= (int) (term * 12); 
         monthlyInterest = interest/(12 * 100);   
         denominator = Math.pow(1 + monthlyInterest, -(term*12));
         denominator = 1 - denominator;
         monthlyPayment = principal * (monthlyInterest / denominator);

  // Monthly payment formula: M = P x (J/(1-(1+J)^-N));
   // M = P * ( J / (1 - (1 + J) ** -N));
   // source: http://www.hughchou.org/calc/formula.html
   monthlyPayment = (double)(principal*(monthlyInterest / (1-(Math.pow((1+monthlyInterest),(numOfMonths*-1))))));
     return monthlyPayment - (remainingPrincipal * monthlyInterest);



  //calculate the monthly interst using simple interest.
  double getremainingPrincipal;

  return monthlyPayment - (remainingPrincipal * monthlyInterest);


    // Finally, set the text field to show the result
	mPaymentText.setText("Payment = " + monthlyPayment);
    }
  public void actionPerformed(ActionEvent event)
    {
       try
       { // Capture the Info the User Entered, remove 's and make it a double

        MortgageInfo.setInterestRatePercent(Double.parseDouble(intRateText.getText().replaceAll(",","")));
        MortgageInfo.setloanAmount(Double.parseDouble(mortgageText.getText().replaceAll(",","")));
        MortgageInfo.setloanYears(Double.parseDouble(termText.getText().replaceAll(",","")));   // Get & Format the Results
        double test=MortgageInfo.getpaymentAmount();
        DecimalFormat myFormatter = new DecimalFormat("$###,###.00");
        mPaymentText.setText("<html><font color=blue>"+myFormatter.format(test)+"</font></html>");
   	   }
   	   catch(Exception except)
   	   {

       }
  }

    {


        
                rbTwo.addActionListener(new java.awt.event.ActionListener() {
            public void ActionListeneractionPerformed(ActionEvent event) {
                rbTwoActionPerformed(event);
            }

            public void actionPerformed(ActionEvent event) {
                throw new UnsupportedOperationException("Not supported yet.");
            }
        });
                             
             rbThree.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent event) {
                rbThreeActionPerformed(event);
            }
        });


            rbOne.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent event) {
                rbOneActionPerformed(event);
            }
        });
        
        
                 }
        private void rbTwoActionPerformed(java.awt.event.ActionEvent event) {                                              
        termText.setText("15");
        intRateText.setText("5.5");
    }   
        
        private void rbThreeActionPerformed(java.awt.event.ActionEvent event) {                                              
        termText.setText("30");
        intRateText.setText("5.75");
        
          }       
       private void rbOneActionPerformed(java.awt.event.ActionEvent event) {                                             
        termText.setText("7");
        intRateText.setText("5.35");
       }  
       

    

//***************Create commands for JMenuBar**************************
    public void actionPerformed(ActionEvent event) {
        Object command1 = event.getSource();

        if (event.getSource() == calculateButton) {
            setResultValue();
        }

//*************Exit Routine for File Exit******************************
        if (event.getSource() == exitButton) {
            System.exit(0);
        }
//*************Clear Routine for Function Clear************************
        if (event.getSource() == clearButton) {
            {
                mortgageText.setText(null);
                termText.setText(null);
                intRateText.setText(null);
                mPaymentText.setText(null);


            }





        }

    }
}

fix the first and you may find that several others disappear as well (though new ones may appear).
Go down the list until you've fixed them all.

But not being psychic we can't tell what those errors may be unless you tell us so we can't even begin to try to hint at what you could do to fix them.

Maybe it would help if I tell you what are the errors I'm getting.

line 267: actionPerformed(java.awt.event.ActionEvent) is already defined in MortgageCalc3 
public void actionPerformed(ActionEvent event) {

(If I take this one out, I get more errors on the lines beneath)
I have been trying to work with NetBeans and highlights them.

The next error

line 71 cannot find symbol
symbol: contructor JApplet(java.lang.String)
Location:class javax.swing.JApplet
super(KARIN"S CALC");

This one was working until I added the array this morning, I'm not sure what I did wrong. I know I messed it up.

line 73: cannot find symbol
symbol: method set defaultCloseOperation(int)
location: class MortgageCalc3
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

This is the same as the one right above this one. I added the array and it no longer works either.

Line 175 possible loss of precision
found: double
required: int
monthlyInterest = annualInterest[i]/(12*100);
Line 176: possible loss of precision
found: double
required: int
int totalNumOfMonths + numOfYears[i]*12
line 188 : cannot return value from method whose result type is void
return monthlyPayment- (remainingPrincipal * monthlyInterest);

( the arrow is on the minus)

java 195 : cannot return value from method whose result type is void
return monthlyPayment - (remainingPrincipal * monthlyInterest);

(again on this one the arrow is on the minus)

line 206: cannot find symbol
symbol: variable MortgageInfo
location: class MortgageCalc3
MortgageInfo.setInterestRatePercent(Double.parseDouble(intRateText.getText().replaceAll(",","")));
line 207: cannot find symbol
symbol: variable MortgageInfo
location: class MortgageCalc3
MortgageInfo.setloanAmount(Double.parseDouble(mortgageText.getText().replaceAll(",","")));
line 208: cannot find symbol
location: class MortgageCalc3
MortgageInfo.setloanAmount
MortgageInfo.setloanYears(Double.parseDouble(termText.getText().replaceAll(",","")));
line 209: cannot find symbol
location: class MortgageCalc3
MortgageInfo.setloanAmount
double test=MortgageInfo.getpaymentAmount();
line 271: cannot find symbol
symbol: method setResultValue()
location: class MortgageCalc3
setResultValue();

And I thank you guys in advance!!!

But not being psychic we can't tell what those errors may be unless you tell us so we can't even begin to try to hint at what you could do to fix them.

I really apoligize about it. I have added the errors that I'm having in here. Would you please, please, please help me! Pleaseee.

at first glance you probably have some missing braces somewhere. Everything points to some things being defined in the wrong scope, causing it to not be visible where you think it is.

at first glance you probably have some missing braces somewhere. Everything points to some things being defined in the wrong scope, causing it to not be visible where you think it is.

Ok, I tried playing with it some more. And now it's giving me 2 errors.
The first one is on

line 171: '.class' expected
monthlyInterest = annualInterests[]/(12*100);

And my second one is here,

line 172: '.class' expected
int totalNumOfMonths = numOfYears[]*12;

And this is what I did to the code. Would please let me know what do you think?

/* 
 * Program: Mortgage Calculator with Graphical User Interface
 * Programs accepts user input in 3 text fields: Mortgage Amount, Mortgage Term, and Interest Rate.
 * User can calculate the monthly payment amount from a selection of the following:
 *              7 year loan at 5.35%
 *		15 year loan at 5.50%	 
 *		30 year loan at 5.75%	
 * The user can enter the new available choices and get the different loan amounts, the  balance and the monthly interest in an array.		
 *
 */

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.Double;
import java.text.DecimalFormat;
import javax.swing.event.*;
import java.text.*;
import java.util.*;
import javax.swing.border.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
// Create MortgageCalculator class
public class MortgageCalc3 extends JFrame implements ActionListener {

// Radio Button Selection
    JPanel rowOne = new JPanel();
    JRadioButton rbOne = new JRadioButton("7 Years/5.35%", true);
    JRadioButton rbTwo = new JRadioButton("15 Years/5.5%", true);
    JRadioButton rbThree = new JRadioButton("30 Years/5.75%", true);

// Text Amount for Mortgage
    JPanel rowTwo = new JPanel();
    JLabel mortgageLabel = new JLabel("Mortgage Amount $", JLabel.LEFT);
    JTextField mortgageText = new JTextField(10);
    JLabel termLabel = new JLabel("Mortgage Term (Years)", JLabel.LEFT);
    JTextField termText = new JTextField(3);
    JLabel intRateLabel = new JLabel("Interest Rate (%)", JLabel.LEFT);
    JTextField intRateText = new JTextField(5);
    JLabel mPaymentLabel = new JLabel("Monthly Payment $", JLabel.LEFT);
    JTextField mPaymentText = new JTextField(10);

// Create buttons to calculate payment, amortizaton, and clear fields
    JPanel rowThree = new JPanel();
    JButton calculateButton = new JButton("CALCULATE");
    JButton clearButton = new JButton("CLEAR");
    JButton exitButton = new JButton("EXIT");

// Create Label for Text Box
    JPanel rowFour = new JPanel();
    JLabel paymentLabel = new JLabel("Payment #");
    JLabel balLabel = new JLabel(" Balance");
    JLabel ytdPrincLabel = new JLabel(" Principal");
    JLabel ytdIntLabel = new JLabel(" Interest");

// Display area
    JPanel rowFive = new JPanel(new FlowLayout());
    JTextArea textArea = new JTextArea(10, 31);
    JScrollPane scroll = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    public MortgageCalc3() {
        super("KARIN'S CALC");
        setSize(400, 485);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container pane = getContentPane();
        JScrollPane scroll1 = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        FlowLayout layout = new FlowLayout(FlowLayout.LEFT);
        pane.setLayout(layout);


// Add to the screen
        FlowLayout layout1 = new FlowLayout();
        rowOne.setLayout(layout1);

// Add Radio Button Group
        ButtonGroup btnGrp = new ButtonGroup();
        btnGrp.add(rbOne);
        btnGrp.add(rbTwo);
        btnGrp.add(rbThree);
        rowOne.add(rbOne);
        rowOne.add(rbTwo);
        rowOne.add(rbThree);
        pane.add(rowOne);

// Create a border around the radio buttons
        Border titledRadioBorder =
                BorderFactory.createTitledBorder("Make your selections");
        rowOne.setBorder(titledRadioBorder);

// Listeners
        rbOne.addActionListener(this);
        rbTwo.addActionListener(this);
        rbThree.addActionListener(this);



// Add Labels & Text Boxes
        GridLayout layout2 = new GridLayout(4, 1);
        rowTwo.setLayout(layout2);
        rowTwo.add(mortgageLabel);
        rowTwo.add(mortgageText);
        mortgageText.setText("200000");
        rowTwo.add(termLabel);
        rowTwo.add(termText);
        termText.setText("30");
        rowTwo.add(intRateLabel);
        rowTwo.add(intRateText);
        intRateText.setText("5.75");
        rowTwo.add(mPaymentLabel);
        rowTwo.add(mPaymentText);
        mPaymentText.setEnabled(false);
        pane.add(rowTwo);

// Add Buttons
        FlowLayout layout3 = new FlowLayout(FlowLayout.CENTER, 10, 10);
        rowThree.setLayout(layout3);
        rowThree.add(calculateButton);
        calculateButton.setBackground(Color.green);
        rowThree.add(clearButton);
        clearButton.setBackground(Color.white);
        rowThree.add(exitButton);
        exitButton.setBackground(Color.red);
        pane.add(rowThree);

// Listeners
        calculateButton.addActionListener(this);
        clearButton.addActionListener(this);
        exitButton.addActionListener(this);

// Add Text Box Label
        FlowLayout layout4 = new FlowLayout(FlowLayout.LEFT, 10, 10);
        rowFour.setLayout(layout4);
        rowFour.add(paymentLabel);
        rowFour.add(balLabel);
        rowFour.add(ytdPrincLabel);
        rowFour.add(ytdIntLabel);
        pane.add(rowFour);

// Add Text Box
        FlowLayout layout5 = new FlowLayout(FlowLayout.CENTER, 10, 10);
        rowFive.setLayout(layout5);
        rowFive.add(scroll1);
        pane.add(rowFive);

        setContentPane(pane);
        setVisible(true);
    }

    public static void main(String[] args) throws Exception {
        DecimalFormat dollarAmount = new DecimalFormat("#,###.00");
        DecimalFormat percentAmount = new DecimalFormat("##.##");

        MortgageCalc3 frame = new MortgageCalc3();
    }

    

    public void setResultValue() {
double monthlyPayment, monthlyInterest, denominator, numOfMonths, getMortgageAmount,MortgageInfo ;
   double[] annualInterests  = {5.35,5.5,5.75}; //Interest Array
   int[] numOfYears    = {7,15,30}; //Term Array
  
   
        double principal = Double.parseDouble(mortgageText.getText());
        double term = Double.parseDouble(termText.getText());
        double interest = Double.parseDouble(intRateText.getText());
	float paymentdue;
	monthlyInterest = annualInterests[]/(12*100);
    	int totalNumOfMonths = numOfYears[]*12;

         int months= (int) (term * 12); 
         monthlyInterest = interest/(12 * 100);   
         denominator = Math.pow(1 + monthlyInterest, -(term*12));
         denominator = 1 - denominator;
         monthlyPayment = principal * (monthlyInterest / denominator);

  // Monthly payment formula: M = P x (J/(1-(1+J)^-N));
   // M = P * ( J / (1 - (1 + J) ** -N));
   // source: http://www.hughchou.org/calc/formula.html
   monthlyPayment = (double)(principal*(monthlyInterest / (1-(Math.pow((1+monthlyInterest),(numOfMonths*-1))))));
        double remainingPrincipal;
     return monthlyPayment - (remainingPrincipal * monthlyInterest);



  //calculate the monthly interst using simple interest.
  double getremainingPrincipal;

  return monthlyPayment - (remainingPrincipal * monthlyInterest);

     
    // Finally, set the text field to show the result
	mPaymentText.setText("Payment = " + monthlyPayment);
  }
      
  public void actionPerformed(ActionEvent event)
    {
       try
       { // Capture the Info the User Entered, remove 's and make it a double

        MortgageInfo.setInterestRatePercent(Double.parseDouble(intRateText.getText().replaceAll(",","")));
        MortgageInfo.setloanAmount(Double.parseDouble(mortgageText.getText().replaceAll(",","")));
        MortgageInfo.setloanYears(Double.parseDouble(termText.getText().replaceAll(",","")));   // Get & Format the Results
        double test=MortgageInfo.getpaymentAmount();
        DecimalFormat myFormatter = new DecimalFormat("$###,###.00");
        mPaymentText.setText("<html><font color=blue>"+myFormatter.format(test)+"</font></html>");
   	   }

  catch(Exception except)
   	   {

       }
  }

    

  {
        
               rbTwo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbTwoActionPerformed(evt);
            }
        });
                             
             rbThree.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbThreeActionPerformed(evt);
            }
        });


            rbOne.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbOneActionPerformed(evt);
            }
        });
        
        
                 }
        private void rbTwoActionPerformed(java.awt.event.ActionEvent evt) {                                              
        termText.setText("15");
        intRateText.setText("5.5");
    }   
        
        private void rbThreeActionPerformed(java.awt.event.ActionEvent evt) {                                              
        termText.setText("30");
        intRateText.setText("5.75");
        
          }       
       private void rbOneActionPerformed(java.awt.event.ActionEvent evt) {                                             
        termText.setText("7");
        intRateText.setText("5.35");
       }  
       

    

//***************Create commands for JMenuBar**************************
    public void actionPerformed(ActionEvent event) {
        Object command1 = event.getSource();

        if (event.getSource() == calculateButton) {
            setResultValue();
        }

//*************Exit Routine for File Exit******************************
        if (event.getSource() == exitButton) {
            System.exit(0);
        }
//*************Clear Routine for Function Clear************************
        if (event.getSource() == clearButton) {
            {
                mortgageText.setText(null);
                termText.setText(null);
                intRateText.setText(null);
                mPaymentText.setText(null);


            }
        }
    }
}

Ha! Ha! I fixed the two but I got new ones. Some of the old ones came back to surface.

line 262: actionPerformed(java.awt.event.ActionEvent) is already defined in MortgageCalc3 
public void actionPerformed(ActionEvent event) {

When I fixed the prior problems like this but created even more. This is what I did.

public void setResultValue(int i) {
double monthlyPayment, monthlyInterest, denominator, numOfMonths, getMortgageAmount,MortgageInfo ;
   double[] annualInterests  = {5.35,5.5,5.75}; //Interest Array
   int[] numOfYears    = {7,15,30}; //Term Array
  
   
        double principal = Double.parseDouble(mortgageText.getText());
        double term = Double.parseDouble(termText.getText());
        double interest = Double.parseDouble(intRateText.getText());
	float paymentdue;
	monthlyInterest = (int) (annualInterests[i] / (12 * 100));
    	int totalNumOfMonths = (int) (numOfYears[i]*12);

So now it's not letting me use it here. This error I would have the first clue on how to fix. I have more errors but I'm gonna play with it again. Thanks in advance! And I appreciate your time!

public void actionPerformed(ActionEvent event) {
        Object command1 = event.getSource();

        if (event.getSource() == calculateButton) {
            setResultValue();
        }

//*************Exit Routine for File Exit******************************
        if (event.getSource() == exitButton) {
            System.exit(0);
        }
//*************Clear Routine for Function Clear************************
        if (event.getSource() == clearButton) {
            {
                mortgageText.setText(null);
                termText.setText(null);
                intRateText.setText(null);
                mPaymentText.setText(null);


            }
        }
    }

Not sure if you know this but you can use Java-specific code tags, so this

public void setResultValue(int i) {
double monthlyPayment, monthlyInterest, denominator, numOfMonths, getMortgageAmount,MortgageInfo ;
   double[] annualInterests  = {5.35,5.5,5.75}; //Interest Array
   int[] numOfYears    = {7,15,30}; //Term Array
  
   
        double principal = Double.parseDouble(mortgageText.getText());
        double term = Double.parseDouble(termText.getText());
        double interest = Double.parseDouble(intRateText.getText());
	float paymentdue;
	monthlyInterest = (int) (annualInterests[i] / (12 * 100));
    	int totalNumOfMonths = (int) (numOfYears[i]*12);

turns into this:

public void setResultValue(int i) {
double monthlyPayment, monthlyInterest, denominator, numOfMonths, getMortgageAmount,MortgageInfo ;
   double[] annualInterests  = {5.35,5.5,5.75}; //Interest Array
   int[] numOfYears    = {7,15,30}; //Term Array
  
   
        double principal = Double.parseDouble(mortgageText.getText());
        double term = Double.parseDouble(termText.getText());
        double interest = Double.parseDouble(intRateText.getText());
	float paymentdue;
	monthlyInterest = (int) (annualInterests[i] / (12 * 100));
    	int totalNumOfMonths = (int) (numOfYears[i]*12);

It sticks the line numbers in there too, which is helpful since you're quoting line numbers in the error messages. It's less helpful when you post fragments since everything starts from line 1, so you have to point out the revised line number. Just do:

[code=JAVA] // Java code here

[/code]

Regarding the errors, it's not entirely clear what you have caught and what you have not, but it seems like you still have the duplicate actionPerformed , which is not allowed. I wouldn't be surprised if, as jwenting says, it's a bracket issue. Since you are using NetBeans, it has a cool feature on the left side of the displayed code. The functions all have + and - signs so you can minimize and maximize functions. Maximizing and minimizing the functions catches the matching brackets fast, as well as making there be less code to scroll through. You may already know that feature, but I figured I'd throw it out there. It's a real time saver. If you think you have a really short function and minimizing it causes 200 lines to disappear, that's usually a brackets issue. And vise versa. If it's supposed to be long and minimizing it only removes four lines, you probably have an extra bracket.

I hope this is better. I have been moving things arounds and changing things everywhere. Yes, it says that I have a duplicate actionPerformed but everytime I take it out it gives me even more errors and tells me that the symbol annot be found. Believe it or not I didn't know about the collapsing feature and I think that's very cool, I have a question though, I wasn't able to collapse the upper part of my code (right after my imports), I tried putting brackets but it didn't really like it. So I copied and pasted the way you said, I think it will look a lot better and you guys wil be able to read it easier. I appreciate all of your input and your time. Thank you!

/* 
 * Program: Mortgage Calculator with Graphical User Interface
 * Programs accepts user input in 3 text fields: Mortgage Amount, Mortgage Term, and Interest Rate.
 * User can calculate the monthly payment amount from a selection of the following:
 *              7 year loan at 5.35%
 *		15 year loan at 5.50%	 
 *		30 year loan at 5.75%	
 * The user can enter the new available chice for te loan at the top of calulator by getting the 		
 * cursor on the desired field and backspace and enter new data. the user can quit by clicking on EXIT
 */

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;
import javax.swing.event.*;
import java.text.*;
import java.util.*;
import javax.swing.border.*;
import javax.swing.JFrame;
import javax.swing.JPanel;

// Create MortgageCalculator class
public class MortgageCalc3 extends JFrame implements ActionListener {
   
// Radio Button Selection
    JPanel rowOne = new JPanel();
    JRadioButton rbOne = new JRadioButton("7 Years/5.35%", true);
    JRadioButton rbTwo = new JRadioButton("15 Years/5.5%", true);
    JRadioButton rbThree = new JRadioButton("30 Years/5.75%", true);

// Text Amount for Mortgage
    JPanel rowTwo = new JPanel();
    JLabel mortgageLabel = new JLabel("Mortgage Amount $", JLabel.LEFT);
    JTextField mortgageText = new JTextField(10);
    JLabel termLabel = new JLabel("Mortgage Term (Years)", JLabel.LEFT);
    JTextField termText = new JTextField(3);
    JLabel intRateLabel = new JLabel("Interest Rate (%)", JLabel.LEFT);
    JTextField intRateText = new JTextField(5);
    JLabel mPaymentLabel = new JLabel("Monthly Payment $", JLabel.LEFT);
    JTextField mPaymentText = new JTextField(10);

// Create buttons to calculate payment, amortizaton, and clear fields
    JPanel rowThree = new JPanel();
    JButton calculateButton = new JButton("CALCULATE");
    JButton clearButton = new JButton("CLEAR");
    JButton exitButton = new JButton("EXIT");

// Create Label for Text Box
    JPanel rowFour = new JPanel();
    JLabel paymentLabel = new JLabel("Payment #");
    JLabel balLabel = new JLabel(" Balance");
    JLabel ytdPrincLabel = new JLabel(" Principal");
    JLabel ytdIntLabel = new JLabel(" Interest");

// Display area
    JPanel rowFive = new JPanel(new FlowLayout());
    JTextArea textArea = new JTextArea(10, 31);
    JScrollPane scroll = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    public MortgageCalc3() {
        super("KARIN'S CALC");
        setSize(400, 485);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container pane = getContentPane();
        JScrollPane scroll1 = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        FlowLayout layout = new FlowLayout(FlowLayout.LEFT);
        pane.setLayout(layout);


// Add to the screen
        FlowLayout layout1 = new FlowLayout();
        rowOne.setLayout(layout1);

// Add Radio Button Group
        ButtonGroup btnGrp = new ButtonGroup();
        btnGrp.add(rbOne);
        btnGrp.add(rbTwo);
        btnGrp.add(rbThree);
        rowOne.add(rbOne);
        rowOne.add(rbTwo);
        rowOne.add(rbThree);
        pane.add(rowOne);

// Create a border around the radio buttons
        Border titledRadioBorder =
                BorderFactory.createTitledBorder("Make your selections");
        rowOne.setBorder(titledRadioBorder);

// Listeners
        rbOne.addActionListener(this);
        rbTwo.addActionListener(this);
        rbThree.addActionListener(this);



// Add Labels & Text Boxes
        GridLayout layout2 = new GridLayout(4, 1);
        rowTwo.setLayout(layout2);
        rowTwo.add(mortgageLabel);
        rowTwo.add(mortgageText);
        mortgageText.setText("200000");
        rowTwo.add(termLabel);
        rowTwo.add(termText);
        termText.setText("30");
        rowTwo.add(intRateLabel);
        rowTwo.add(intRateText);
        intRateText.setText("5.75");
        rowTwo.add(mPaymentLabel);
        rowTwo.add(mPaymentText);
        mPaymentText.setEnabled(false);
        pane.add(rowTwo);

// Add Buttons
        FlowLayout layout3 = new FlowLayout(FlowLayout.CENTER, 10, 10);
        rowThree.setLayout(layout3);
        rowThree.add(calculateButton);
        calculateButton.setBackground(Color.green);
        rowThree.add(clearButton);
        clearButton.setBackground(Color.white);
        rowThree.add(exitButton);
        exitButton.setBackground(Color.red);
        pane.add(rowThree);

// Listeners
        calculateButton.addActionListener(this);
        clearButton.addActionListener(this);
        exitButton.addActionListener(this);

// Add Text Box Label
        FlowLayout layout4 = new FlowLayout(FlowLayout.LEFT, 10, 10);
        rowFour.setLayout(layout4);
        rowFour.add(paymentLabel);
        rowFour.add(balLabel);
        rowFour.add(ytdPrincLabel);
        rowFour.add(ytdIntLabel);
        pane.add(rowFour);

// Add Text Box
        FlowLayout layout5 = new FlowLayout(FlowLayout.CENTER, 10, 10);
        rowFive.setLayout(layout5);
        rowFive.add(scroll1);
        pane.add(rowFive);

        setContentPane(pane);
        setVisible(true);
    }

    public static void main(String[] args) throws Exception {
        DecimalFormat dollarAmount = new DecimalFormat("#,###.00");
        DecimalFormat percentAmount = new DecimalFormat("##.##");

        MortgageCalc3 frame = new MortgageCalc3();
    }

    

    public int setResultValue(int i) {
double monthlyPayment, monthlyInterest, denominator, numOfMonths, getMortgageAmount,MortgageInfo ;
   double[] annualInterests  = {5.35,5.5,5.75}; //Interest Array
   int[] numOfYears    = {7,15,30}; //Term Array
  
   
        double principal = Double.parseDouble(mortgageText.getText());
        double term = Double.parseDouble(termText.getText());
        double interest = Double.parseDouble(intRateText.getText());
	float paymentdue;
	monthlyInterest = (int) (annualInterests[i] / (12 * 100));
    	int totalNumOfMonths = (int) (numOfYears[i]*12);

         int months= (int) (term * 12); 
         monthlyInterest = interest/(12 * 100);   
         denominator = Math.pow(1 + monthlyInterest, - (term*12));
         denominator = 1 - denominator;
         monthlyPayment = principal * (monthlyInterest / denominator);

  // Monthly payment formula: M = P x (J/(1-(1+J)^-N));
   // M = P * ( J / (1 - (1 + J) ** -N));
   // source: http://www.hughchou.org/calc/formula.html
   monthlyPayment = (double)(principal*(monthlyInterest / (1-(Math.pow((1+monthlyInterest),(numOfMonths*-1))))));
        double remainingPrincipal;
     return (int) (monthlyPayment - (remainingPrincipal * monthlyInterest));



  //calculate the monthly interst using simple interest.
  double getremainingPrincipal;

  return (int) (monthlyPayment - (remainingPrincipal * monthlyInterest));

     
    // Finally, set the text field to show the result
	mPaymentText.setText("Payment = " + monthlyPayment);
  }
      
  public void actionPerformed(ActionEvent event){
       try
             
               
       { // Capture the Info the User Entered, remove 's and make it a double
        MortgageInfo.setInterestRatePercent(Double.parseDouble(intRateText.getText().replaceAll(",","")));
        MortgageInfo.setloanAmount(Double.parseDouble(mortgageText.getText().replaceAll(",","")));
        MortgageInfo.setloanYears(Double.parseDouble(termText.getText().replaceAll(",","")));   // Get & Format the Results
        double test=MortgageInfo.getpaymentAmount();
        DecimalFormat myFormatter = new DecimalFormat("$###,###.00");
        mPaymentText.setText("<html><font color=blue>"+myFormatter.format(test)+"</font></html>");
   	   }

  catch(Exception except)
   	   {

       }
  }



  {
        
               rbTwo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbTwoActionPerformed(evt);
            }
        });
                             
             rbThree.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbThreeActionPerformed(evt);
            }
        });


            rbOne.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbOneActionPerformed(evt);
            }
        });
        
        
                 }
  private void rbTwoActionPerformed(java.awt.event.ActionEvent evt) {                                              
        termText.setText("15");
        intRateText.setText("5.5");
    }   
        
        private void rbThreeActionPerformed(java.awt.event.ActionEvent evt) {                                              
        termText.setText("30");
        intRateText.setText("5.75");
        
          }       
       private void rbOneActionPerformed(java.awt.event.ActionEvent evt) {                                             
        termText.setText("7");
        intRateText.setText("5.35");
       }  
       
 
       
//***************Create commands for JMenuBar**************************
 public void actionPerformed(ActionEvent event){
        Object command1 = event.getSource();

        if (event.getSource() == calculateButton) {
            setResultValue(int);
        }

//*************Exit Routine for File Exit******************************
        if (event.getSource() == exitButton) {
            System.exit(0);
        }
//*************Clear Routine for Function Clear************************
        if (event.getSource() == clearButton) {
            {
                mortgageText.setText(null);
                termText.setText(null);
                intRateText.setText(null);
                mPaymentText.setText(null);


            } 
        }
    }
}

Yeah, I couldn't minimize the top code either. Not sure why. However, using the other minimizers, I found what I believe is a bracket issue right after the FIRST actionPerformed function and before function rbTwoActionPerformed, from lines 219 through 241:

{
        
               rbTwo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbTwoActionPerformed(evt);
            }
        });
                             
             rbThree.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbThreeActionPerformed(evt);
            }
        });


            rbOne.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbOneActionPerformed(evt);
            }
        });
        
        
                 }

The line numbers above start at 1, but it's the same code. This code appears to be in limbo as far as I can tell. It is adding action listeners to JRadioButtons rbOne, rbTwo, and rbThree. I am wondering if this whole block of code can be deleted. You have already added action listeners to these three JRadioButtons in lines 93 through 95.

rbOne.addActionListener(this);
rbTwo.addActionListener(this);
rbThree.addActionListener(this);

You are assigning these buttons action listeners twice. I would remove the lines from 219 through 241 and have the bottom actionPerformed function handle all the "actionPerformed" duties fro the whole class. For sure, if you decide to assign different action listener functions for different objects so it's not all one big actionPerformed, you only want to have one addActionListener assignment command for each object. You have two for each of these three buttons.

I would try to incorporate it all into one big actionPerformed function. You can call other functions from that big actionPerformed function to deal with those three JRadioButtons FROM actionPerformed if you like. That is how I would do it.

As to your FIRST actionPerformed function from lines 202 through 215, you are trying to make a lot of function calls to functions which don't exist, unless there is another file somewhere that is not in the code you posted or I missed it somehow.

public void actionPerformed(ActionEvent event){
       try
             
               
       { // Capture the Info the User Entered, remove 's and make it a double
        MortgageInfo.setInterestRatePercent(Double.parseDouble(intRateText.getText().replaceAll(",","")));
        MortgageInfo.setloanAmount(Double.parseDouble(mortgageText.getText().replaceAll(",","")));
        MortgageInfo.setloanYears(Double.parseDouble(termText.getText().replaceAll(",","")));   // Get & Format the Results
        double test=MortgageInfo.getpaymentAmount();
        DecimalFormat myFormatter = new DecimalFormat("$###,###.00");
        mPaymentText.setText("<html><font color=blue>"+myFormatter.format(test)+"</font></html>");
   	   }

  catch(Exception except)
   	   {

       }
  }

Where are the setloanAmount, setloanYears, etc. functions?

Hello VernonDozier, if I could kick myself in the head I would but I can't just like this. Ok, so I'm following your advise and I have removed the already called action performed for the radio buttons that don't work (ha! Ha!) I tried my best to make them work but no luck, I changed some of the functions but now it's not recognizing them as already called (line 193 to 199) not really sure what I'm doing wrong. Do you think the formula would work? I want to make sure I can get the monthly payment, along with the interest per month and the balance for the $200000 in the 3 different terms and rates. My calculator was working until I added the array (well, not the whole calculator, the radio buttons were not working ). You don't understand how much I appreciate your help. I cannot thank you enough!

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;
import javax.swing.event.*;
import java.text.*;
import java.util.*;
import javax.swing.border.*;
import javax.swing.JFrame;
import javax.swing.JPanel;

// Create MortgageCalculator class
public class MortgageCalc3 extends JFrame implements ActionListener {
   
// Radio Button Selection
    JPanel rowOne = new JPanel();
    JRadioButton rbOne = new JRadioButton("7 Years/5.35%", true);
    JRadioButton rbTwo = new JRadioButton("15 Years/5.5%", true);
    JRadioButton rbThree = new JRadioButton("30 Years/5.75%", true);

// Text Amount for Mortgage
    JPanel rowTwo = new JPanel();
    JLabel mortgageLabel = new JLabel("Mortgage Amount $", JLabel.LEFT);
    JTextField mortgageText = new JTextField(10);
    JLabel termLabel = new JLabel("Mortgage Term (Years)", JLabel.LEFT);
    JTextField termText = new JTextField(3);
    JLabel intRateLabel = new JLabel("Interest Rate (%)", JLabel.LEFT);
    JTextField intRateText = new JTextField(5);
    JLabel mPaymentLabel = new JLabel("Monthly Payment $", JLabel.LEFT);
    JTextField mPaymentText = new JTextField(10);

// Create buttons to calculate payment, amortizaton, and clear fields
    JPanel rowThree = new JPanel();
    JButton calculateButton = new JButton("CALCULATE");
    JButton clearButton = new JButton("CLEAR");
    JButton exitButton = new JButton("EXIT");

// Create Label for Text Box
    JPanel rowFour = new JPanel();
    JLabel paymentLabel = new JLabel("Payment #");
    JLabel balLabel = new JLabel(" Balance");
    JLabel ytdPrincLabel = new JLabel(" Principal");
    JLabel ytdIntLabel = new JLabel(" Interest");

// Display area
    JPanel rowFive = new JPanel(new FlowLayout());
    JTextArea textArea = new JTextArea(10, 31);
    JScrollPane scroll = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    public MortgageCalc3() {
        super("KARIN'S CALC");
        setSize(400, 485);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container pane = getContentPane();
        JScrollPane scroll1 = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        FlowLayout layout = new FlowLayout(FlowLayout.LEFT);
        pane.setLayout(layout);


// Add to the screen
        FlowLayout layout1 = new FlowLayout();
        rowOne.setLayout(layout1);

// Add Radio Button Group
        ButtonGroup btnGrp = new ButtonGroup();
        btnGrp.add(rbOne);
        btnGrp.add(rbTwo);
        btnGrp.add(rbThree);
        rowOne.add(rbOne);
        rowOne.add(rbTwo);
        rowOne.add(rbThree);
        pane.add(rowOne);

// Create a border around the radio buttons
        Border titledRadioBorder =
                BorderFactory.createTitledBorder("Make your selections");
        rowOne.setBorder(titledRadioBorder);

// Listeners
        rbOne.addActionListener(this);
        rbTwo.addActionListener(this);
        rbThree.addActionListener(this);



// Add Labels & Text Boxes
        GridLayout layout2 = new GridLayout(4, 1);
        rowTwo.setLayout(layout2);
        rowTwo.add(mortgageLabel);
        rowTwo.add(mortgageText);
        mortgageText.setText("200000");
        rowTwo.add(termLabel);
        rowTwo.add(termText);
        termText.setText("30");
        rowTwo.add(intRateLabel);
        rowTwo.add(intRateText);
        intRateText.setText("5.75");
        rowTwo.add(mPaymentLabel);
        rowTwo.add(mPaymentText);
        mPaymentText.setEnabled(false);
        pane.add(rowTwo);

// Add Buttons
        FlowLayout layout3 = new FlowLayout(FlowLayout.CENTER, 10, 10);
        rowThree.setLayout(layout3);
        rowThree.add(calculateButton);
        calculateButton.setBackground(Color.green);
        rowThree.add(clearButton);
        clearButton.setBackground(Color.white);
        rowThree.add(exitButton);
        exitButton.setBackground(Color.red);
        pane.add(rowThree);

// Listeners
        calculateButton.addActionListener(this);
        clearButton.addActionListener(this);
        exitButton.addActionListener(this);

// Add Text Box Label
        FlowLayout layout4 = new FlowLayout(FlowLayout.LEFT, 10, 10);
        rowFour.setLayout(layout4);
        rowFour.add(paymentLabel);
        rowFour.add(balLabel);
        rowFour.add(ytdPrincLabel);
        rowFour.add(ytdIntLabel);
        pane.add(rowFour);

// Add Text Box
        FlowLayout layout5 = new FlowLayout(FlowLayout.CENTER, 10, 10);
        rowFive.setLayout(layout5);
        rowFive.add(scroll1);
        pane.add(rowFive);

        setContentPane(pane);
        setVisible(true);
    }

    public static void main(String[] args) throws Exception {
        DecimalFormat dollarAmount = new DecimalFormat("#,###.00");
        DecimalFormat percentAmount = new DecimalFormat("##.##");

        MortgageCalc3 frame = new MortgageCalc3();
    }

    

    public int setResultValue(int i) {
double monthlyPayment, monthlyInterest, denominator, numOfMonths, getMortgageAmount,MortgageInfo,InterestRatePercent ;
   double[] annualInterests  = {5.35,5.5,5.75}; //Interest Array
   int[] numOfYears    = {7,15,30}; //Term Array
  
   
        double principal = Double.parseDouble(mortgageText.getText());
        double term = Double.parseDouble(termText.getText());
        double interest = Double.parseDouble(intRateText.getText());
	float paymentdue;
	monthlyInterest = (int) (annualInterests[i] / (12 * 100));
    	int totalNumOfMonths = (int) (numOfYears[i]*12);

         int months= (int) (term * 12); 
         monthlyInterest = interest/(12 * 100);   
         denominator = Math.pow(1 + monthlyInterest, - (term*12));
         denominator = 1 - denominator;
         monthlyPayment = principal * (monthlyInterest / denominator);

  // Monthly payment formula: M = P x (J/(1-(1+J)^-N));
   // M = P * ( J / (1 - (1 + J) ** -N));
   // source: http://www.hughchou.org/calc/formula.html
   monthlyPayment = (double)(principal*(monthlyInterest / (1-(Math.pow((1+monthlyInterest),(numOfMonths*-1))))));
        double remainingPrincipal;
     return (int) (monthlyPayment - (remainingPrincipal * monthlyInterest));



  //calculate the monthly interst using simple interest.
  double getremainingPrincipal;

  return (int) (monthlyPayment - (remainingPrincipal * monthlyInterest));

     
    // Finally, set the text field to show the result
	mPaymentText.setText("Payment = " + monthlyPayment);
  }
      
  public void actionPerformed(ActionEvent event)
{
       try
             
               
       { // Capture the Info the User Entered, remove 's and make it a double
        mPaymentText.intRateText(Double.parseDouble(intRateText.getText().replaceAll(",","")));
        mPaymentText.mortgageText(Double.parseDouble(mortgageText.getText().replaceAll(",","")));
        mPaymentText.termText(Double.parseDouble(termText.getText().replaceAll(",","")));   // Get & Format the Results
        double test=mPaymentText.monthlyPayment();
        DecimalFormat myFormatter = new DecimalFormat("$###,###.00");
        mPaymentText.setText("<html><font color=blue>"+myFormatter.format(test)+"</font></html>");
   	   }

  catch(Exception except)
   	   {

       }
  }
       
//***************Create commands for JMenuBar**************************
 public void actionPerformed(ActionEvent event){
        Object command1 = event.getSource();

        if (event.getSource() == calculateButton) {
            setResultValue(int);
        }

//*************Exit Routine for File Exit******************************
        if (event.getSource() == exitButton) {
            System.exit(0);
        }
//*************Clear Routine for Function Clear************************
        if (event.getSource() == clearButton) {
            {
                mortgageText.setText(null);
                termText.setText(null);
                intRateText.setText(null);
                mPaymentText.setText(null);


            } 
        }
    }
}

O.K. I revised and cleaned up some of your code but kept it the same as much as I could. I combined the actionPerformed functions. You had a few "variable not initialized" lines in your "setResultValue" function so I commented those lines out. There were some lines I was confused as to where they went, so since they were from an actionPerformed function before, I put them inside that function, but commented out. I added a "return 0" line to your "setResultValue" to make it compile and run. When you fix the calculation code, you should take that line out. Basically no calculations are done, but the action listeners are there and they work. Look at the output window when you run it from NetBeans and you'll see a display of which button is pressed (i.e. if the clearButton is pressed, that fact is displayed to the non-GUI console output). Below is the revised code with the fixed actionPerformed function. It will look better cut and pasted into NetBeans. Click "Toggle Plain Text" to get rid of the line numbers, then cut and paste into NetBeans and compile and run.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;
import javax.swing.event.*;
import java.text.*;
import java.util.*;
import javax.swing.border.*;
import javax.swing.JFrame;
import javax.swing.JPanel;

// Create MortgageCalculator class
public class MortgageCalc3 extends JFrame implements ActionListener {
   
// Radio Button Selection
    JPanel rowOne = new JPanel();
    JRadioButton rbOne = new JRadioButton("7 Years/5.35%", true);
    JRadioButton rbTwo = new JRadioButton("15 Years/5.5%", true);
    JRadioButton rbThree = new JRadioButton("30 Years/5.75%", true);

// Text Amount for Mortgage
    JPanel rowTwo = new JPanel();
    JLabel mortgageLabel = new JLabel("Mortgage Amount $", JLabel.LEFT);
    JTextField mortgageText = new JTextField(10);
    JLabel termLabel = new JLabel("Mortgage Term (Years)", JLabel.LEFT);
    JTextField termText = new JTextField(3);
    JLabel intRateLabel = new JLabel("Interest Rate (%)", JLabel.LEFT);
    JTextField intRateText = new JTextField(5);
    JLabel mPaymentLabel = new JLabel("Monthly Payment $", JLabel.LEFT);
    JTextField mPaymentText = new JTextField(10);

// Create buttons to calculate payment, amortizaton, and clear fields
    JPanel rowThree = new JPanel();
    JButton calculateButton = new JButton("CALCULATE");
    JButton clearButton = new JButton("CLEAR");
    JButton exitButton = new JButton("EXIT");

// Create Label for Text Box
    JPanel rowFour = new JPanel();
    JLabel paymentLabel = new JLabel("Payment #");
    JLabel balLabel = new JLabel(" Balance");
    JLabel ytdPrincLabel = new JLabel(" Principal");
    JLabel ytdIntLabel = new JLabel(" Interest");

// Display area
    JPanel rowFive = new JPanel(new FlowLayout());
    JTextArea textArea = new JTextArea(10, 31);
    JScrollPane scroll = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    public MortgageCalc3() {
        super("KARIN'S CALC");
        setSize(400, 485);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container pane = getContentPane();
        JScrollPane scroll1 = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        FlowLayout layout = new FlowLayout(FlowLayout.LEFT);
        pane.setLayout(layout);


// Add to the screen
        FlowLayout layout1 = new FlowLayout();
        rowOne.setLayout(layout1);

// Add Radio Button Group
        ButtonGroup btnGrp = new ButtonGroup();
        btnGrp.add(rbOne);
        btnGrp.add(rbTwo);
        btnGrp.add(rbThree);
        rowOne.add(rbOne);
        rowOne.add(rbTwo);
        rowOne.add(rbThree);
        pane.add(rowOne);

// Create a border around the radio buttons
        Border titledRadioBorder =
                BorderFactory.createTitledBorder("Make your selections");
        rowOne.setBorder(titledRadioBorder);

// Listeners
        rbOne.addActionListener(this);
        rbTwo.addActionListener(this);
        rbThree.addActionListener(this);

// Add Labels & Text Boxes
        GridLayout layout2 = new GridLayout(4, 1);
        rowTwo.setLayout(layout2);
        rowTwo.add(mortgageLabel);
        rowTwo.add(mortgageText);
        mortgageText.setText("200000");
        rowTwo.add(termLabel);
        rowTwo.add(termText);
        termText.setText("30");
        rowTwo.add(intRateLabel);
        rowTwo.add(intRateText);
        intRateText.setText("5.75");
        rowTwo.add(mPaymentLabel);
        rowTwo.add(mPaymentText);
        mPaymentText.setEnabled(false);
        pane.add(rowTwo);

// Add Buttons
        FlowLayout layout3 = new FlowLayout(FlowLayout.CENTER, 10, 10);
        rowThree.setLayout(layout3);
        rowThree.add(calculateButton);
        calculateButton.setBackground(Color.green);
        rowThree.add(clearButton);
        clearButton.setBackground(Color.white);
        rowThree.add(exitButton);
        exitButton.setBackground(Color.red);
        pane.add(rowThree);

// Listeners
        calculateButton.addActionListener(this);
        clearButton.addActionListener(this);
        exitButton.addActionListener(this);

// Add Text Box Label
        FlowLayout layout4 = new FlowLayout(FlowLayout.LEFT, 10, 10);
        rowFour.setLayout(layout4);
        rowFour.add(paymentLabel);
        rowFour.add(balLabel);
        rowFour.add(ytdPrincLabel);
        rowFour.add(ytdIntLabel);
        pane.add(rowFour);

// Add Text Box
        FlowLayout layout5 = new FlowLayout(FlowLayout.CENTER, 10, 10);
        rowFive.setLayout(layout5);
        rowFive.add(scroll1);
        pane.add(rowFive);

        setContentPane(pane);
        setVisible(true);
    }

    
    public static void main(String[] args) throws Exception {
        DecimalFormat dollarAmount = new DecimalFormat("#,###.00");
        DecimalFormat percentAmount = new DecimalFormat("##.##");

        MortgageCalc3 frame = new MortgageCalc3();
    }

    

    public int setResultValue(int i) {
       double monthlyPayment, monthlyInterest, denominator, numOfMonths, getMortgageAmount,MortgageInfo,InterestRatePercent ;
       double[] annualInterests  = {5.35,5.5,5.75}; //Interest Array
       int[] numOfYears    = {7,15,30}; //Term Array
     
       double principal = Double.parseDouble(mortgageText.getText());
       double term = Double.parseDouble(termText.getText());
       double interest = Double.parseDouble(intRateText.getText());
       float paymentdue;    // had a typo -VD
       monthlyInterest = (int) (annualInterests[i] / (12 * 100));
       int totalNumOfMonths = (int) (numOfYears[i]*12);

       int months= (int) (term * 12); 
       monthlyInterest = interest/(12 * 100);   
       denominator = Math.pow(1 + monthlyInterest, - (term*12));
       denominator = 1 - denominator;
       monthlyPayment = principal * (monthlyInterest / denominator);

       // Monthly payment formula: M = P x (J/(1-(1+J)^-N));
       // M = P * ( J / (1 - (1 + J) ** -N));
       // source: http://www.hughchou.org/calc/formula.html
//        monthlyPayment = (double)(principal*(monthlyInterest / (1-(Math.pow((1+monthlyInterest),(numOfMonths*-1))))));
//        double remainingPrincipal;
//        return (int) (monthlyPayment - (remainingPrincipal * monthlyInterest));



       
       
        //calculate the monthly interst using simple interest.
//        double getremainingPrincipal;

//        return (int) (monthlyPayment - (remainingPrincipal * monthlyInterest));

     
        // Finally, set the text field to show the result
//	mPaymentText.setText("Payment = " + monthlyPayment);
          
          
          return 0;     // VD  -- added to allow compile
                        // take out when above code is working
  }
    
    
    
  public void actionPerformed(ActionEvent event)
  {
    Object objectPressed = event.getSource ();
    
    if (objectPressed == calculateButton)
    {
        System.out.println ("calculateButton pressed!");
        // setResult (int);  // VD - illegal command
    }
    else if (objectPressed == exitButton)
    {
        System.out.println ("exitButton pressed!");
        System.exit(0);
    }
    else if (objectPressed == clearButton)
    {
        System.out.println ("clearButton pressed!");
        mortgageText.setText(null);
        termText.setText(null);
        intRateText.setText(null);
        mPaymentText.setText(null);
    }
    else if (objectPressed == rbOne)
    {
        System.out.println ("rbOne pressed!");
    }
    else if (objectPressed == rbTwo)
    {
        System.out.println ("rbTwo pressed!");
    }
    else if (objectPressed == rbThree)
    {
        System.out.println ("rbThree pressed!");
    }
    
    // You had code below in an actionPerformed.  Not sure which actions this
    // code below goes with.  Commented it out for now.

/*    
       try               
       { // Capture the Info the User Entered, remove 's and make it a double
          mPaymentText.intRateText(Double.parseDouble(intRateText.getText().replaceAll(",","")));
          mPaymentText.mortgageText(Double.parseDouble(mortgageText.getText().replaceAll(",","")));
          mPaymentText.termText(Double.parseDouble(termText.getText().replaceAll(",","")));   // Get & Format the Results
          double test=mPaymentText.monthlyPayment();
          DecimalFormat myFormatter = new DecimalFormat("$###,###.00");
          mPaymentText.setText("<html><font color=blue>"+myFormatter.format(test)+"</font></html>");
       }

       catch(Exception except)
       {
       }
*/    
  }  
}

Please not that line 200 is commented out. You had an illegal call to the setResult function. You try to pass it "int". You need to pass it an actual integer value if you are going to call it. Also should it be "setResultValue" instead?

I tested it out and it worked for me. Let me know if it does not for you.

OMG! It runs and I can see the calculator now!! my clear and my exit buttons do work. But I have noticed it's that when I press on the radio buttons, it doesn't populate the fields with the new information. Im trying to check on the formula and see if I can change it. YOU are the greatest and I thank you so much! I'll probably show you what I have done in about 20-30 minutes. I appreciate everything you are doing for me. Thank you!

That formula is a pain in the behind. It might take me a little longer than I thought. I'm starting everything from scratch so I don't mess up what you have already fixed. :)

I'm still working on the formula. This is what I have so far. In the line 21 and 25 for double getremainingPrincipal; and for mPaymentText.setText("Payment = " + monthlyPayment); it's telling me that is unreachable statement. If I dont put the return 0(zero at the end, I get missing return statement error on line number one. Not sure why those errors but maybe you will be able to assist me there. Thank you so much!

public int setResultValue(int i) {
       double monthlyPayment, monthlyInterest, denominator, numOfMonths = 0, getMortgageAmount,MortgageInfo,InterestRatePercent ;
       double[] annualInterests  = {5.35,5.5,5.75}; //Interest Array
       int[] numOfYears    = {7,15,30}; //Term Array 
     
       double principal = Double.parseDouble(mortgageText.getText());//P = principal
       double term = Double.parseDouble(termText.getText());//L = length of mortgage
       double interest = Double.parseDouble(intRateText.getText());// I = interest
       monthlyInterest = (int) (annualInterests[i] / (12 * 100));//J = monthly interest in decimal form = I / (12 x 100)
       int totalNumOfMonths = (int) (numOfYears[i]*12);//N = number of months over which loan is amortized = L x 12 
       int months= (int) (term * 12); 
       denominator = Math.pow(1 + monthlyInterest, - (term*12));
       denominator = 1 - denominator;       monthlyPayment = principal * (monthlyInterest / denominator);
       
       // Monthly payment formula: M = P x (J/(1-(1+J)^-N)); = M for Monthly payment 
       monthlyPayment = (double)(principal*(monthlyInterest / (1-(Math.pow((1+monthlyInterest),(numOfMonths*-1))))));  
       double remainingPrincipal = 0;
       return (int) (monthlyPayment - (remainingPrincipal * monthlyInterest));

  //Step 1: Calculate H = P x J, this is your current monthly interest  
  double getremainingPrincipal;
  return (int) (monthlyPayment - (remainingPrincipal * monthlyInterest));
  
  // Finally, set the text field to show the result	
  mPaymentText.setText("Payment = " + monthlyPayment);
  return 0;
  }

An unreachable statement is a statement/command that will never ever get executed under any circumstances. Many languages allow you to do that. Java does not. Your commands are executed in order in this function. There are no loops or if statements in this function. Commands are executed in order and no lines are skipped. You have three return statements in this function. Since no lines are ever skipped, this first return statement will be executed. Thus the program will never, under any circumstances, execute any of the code after that first return statement, which is line 18. Thus lines 19 through 26 can never be executed ever, so it makes no difference what those lines are. These are "unreachable" statements. Java does not allow them, so is giving you an error. I'm guessing that you got the "missing return statement" error when you commented out all three return statements. You declare that you are returning an integer and if you have commented out all three return statements, you have none left, and since you said you were returning an integer, that's an error.

What is this function supposed to do? It looks like it is calculating values for several variables. I am wondering if you, instead of returning the result of these calculations, rather want to assign these calculations to some variable.

I see what you mean. I have remove it and put it at the end of the calculation and it works and compiles but I need to make my calculate button work so I changed line #1 to public int setResultValue() {, it should give me a calculation when I press the calulate button, but when I did that now it's asking me to initialized the variable i in line 10. I changed line number one because when I had it like that previously that button worked. Do you have a nother suggestion on what should I do different in the calculate button or instead on line 10? Thank you so much for your help!

public int setResultValue()  {
       double monthlyPayment, monthlyInterest = 0, denominator = 0, numOfMonths = 0, getMortgageAmount,MortgageInfo,InterestRatePercent ;
       double[] annualInterests  = {5.35,5.5,5.75}; //Interest Array
       int[] numOfYears    = {7,15,30}; //Term Array 

       double principal = Double.parseDouble(mortgageText.getText());//P = principal
       double term = Double.parseDouble(termText.getText());//L = length of mortgage
       double interest = Double.parseDouble(intRateText.getText());// I = interest
       float paymentdue;
       int i = (int) (annualInterests[i] / (12 * 100));//J = monthly interest in decimal form = I / (12 x 100)
       int totalNumOfMonths = (int) (numOfYears[i]*12);//N = number of months over which loan is amortized = L x 12 
       int months= (int) (term * 12); 
       denominator1 = denominator;
       denominator1 = Math.pow(1 + monthlyInterest, - (term*12));
       denominator = 1 - denominator;       
       monthlyPayment = principal * (monthlyInterest / denominator);
       
       // Monthly payment formula: M = P x (J/(1-(1+J)^-N)); = M for Monthly payment 
       monthlyPayment = (double)(principal*(monthlyInterest / (1-(Math.pow((1+monthlyInterest),(numOfMonths*-1))))));
  
  // Finally, set the text field to show the result	
  mPaymentText.setText("Payment = " + monthlyPayment);
         double remainingPrincipal = 0;
       return (int) (monthlyPayment - (remainingPrincipal * monthlyInterest));
    }  

  
   
  public void actionPerformed(ActionEvent event)
  {
    Object objectPressed = event.getSource ();
    
    if (objectPressed == calculateButton)
    {
        System.out.println ("calculateButton pressed!");
        setResultValue();
    }
    else if (objectPressed == exitButton)
    {
        System.out.println ("exitButton pressed!");
        System.exit(0);
    }
    else if (objectPressed == clearButton)
    {
        System.out.println ("clearButton pressed!");

        termText.setText(null);
        intRateText.setText(null);
        mPaymentText.setText(null);
    }

What is this function supposed to do? It looks like it is calculating values for several variables. I am wondering if you, instead of returning the result of these calculations, rather want to assign these calculations to some variable.

The whole function is supposed to calculate the monthly payment with the different terms and interest given, and it's supposed to give the remaining balance and the monthly interest also in an array. This calculator has been driving me crazy for sometime and thanks to you I can see some light at the end of the tunnel.:icon_smile:

Okay, I think I see a little more what the goal of the program is. I will explain what I think your goal is. Please correct me if I am mistaken.

You are making calculations based on three user variables:
1) Mortgage amount
2) Interest rate
3) Number of payments

The third variable (number of payments) would be the number of years times 12 since there are 12 months in a year. For simplicity sake let's say 4 years and 2 months, or 50 payments (even though that is not an option). Let's say 12% interest, so 1% interest per month. Let's say a mortgage amount of $100,000. So the first month's interest would be $1000. That would be the maximum interest payment. The average principal payment would be $2,000 per month since $100,000 / 50 payments = $2,000. More interest and less principal would be paid the first month. Thereafter interest payment would decrease, balance would decrease, and principal would increase. So you first calculate the monthly payment. I'm just going to pick a guesstimate number out of the air and say that the monthly payment is $2,500.

So that first month's payment would give $1000 to interest and $1500 to principal, so the loan amount after the first month decreases by $1500 to an outstanding balance of $98,500. You'd have 50 rows of numbers in the text box, something like this?

1  $98,500  $1,500   $1,000
2  $96,980  $1,520   $  980
3  $95,440  $1,540   $  960
.
.
.
50 $     0  $2,450   $   50

Something like the above? The job of the function setResultValue is to calculate these numbers and display them in the text box? I made up the numbers, but my point is that the number of rows of output is the number of payments, which is the number of months in the mortgage term (in your case 7, 15, or 30 years), interest steadily decreases, principal steadily increases, balance is the prior row's balance minus this row's principal, and principal plus interest equals monthly payment. Balance of the last row is zero.

If I'm correct and this is the goal, please let me know. I'll address the particular compiler problems in another post.

Yes, you are completely correct. but the monthly payment should show in the JTextField mPaymentText (Monthly Payment $) and everything else should show in the text box (like the remaining Payment #, balance, Principal and interest). Thank you so much!

But if you think I should put everything in the text box I will do that, thank you, thank you, thank you for all of your time.

Here is the problem with this line since you no longer pass the function any parameters:

int i = (int) (annualInterests[i] / (12 * 100));//J = monthly interest in decimal form = I / (12 x 100)

You are declaring a new variable i in this function. i is not initialized yet and you are trying to initialize it to this:

(int) (annualInterests[i] / (12 * 100))

Keep in mind that i is not initialized at this point. You are telling the computer to calculate the above and assign it to i, yet part of the calculation is this:

annualInterests[i]

Again, i is not initialized yet so the computer cannot figure out what annualInterests is. In order to initialize i in this equation, i must already be initialized. Kind of like the chicken and egg paradox.

In your comment you mention that i represents monthly interest in decimal form

//J = monthly interest in decimal form = I / (12 x 100)

Yet you are declaring that i is an integer:

int i = (int) (annualInterests[i] / (12 * 100));

I think you should instead keep it as a double and keep it as you had it originally in a previous version, with a more descriptive title (monthlyInterest):

monthlyInterest = (int) (annualInterests[i] / (12 * 100));//J = monthly interest in decimal form = I / (12 x 100)

However, you have declared it a double earlier and you want it as a double, so remove the (int) part of the line.

You also have a variable called "interest". You get "interest" from the textBox and calculate monthlyInterest from the annualInterests array. You need to decide which one you want to use for the calculation.

So, I imagine that originally the value passed to the function was 0, 1, or 2 based on which radio button the user pushed.

My advice? Don't have the function return anything. Don't pass it anything. Get the information you need to calculate from the text boxes, not the annualInterests or numOfYears arrays. Take those two arrays out of that function and put them in the actionPerformed function. When the user presses one of those buttons, in the actionPerformed function, change the contents of those text boxes so that they match the numbers that go along with those buttons. Then call the setResultValue function. This allows the user to type in whatever they want and also to use the buttons if they want, and it removes the problem of having more than one value for interest and number of payments. You want your number of payments to be an integer and your interest rate to be a double regardless of how they end up in the variables.

commented: A lot of patient help in this thread. +6

But if you think I should put everything in the text box I will do that, thank you, thank you, thank you for all of your time.

No, I don't think you need to put it all in the text box. I think putting it where you originally wanted to is just fine since it's only one number.

OMG! This is what I have doen so far and I just moved everything but the calculation for the monthly payment to the bottom. It calculates and it gives me a monthly payment and it clears and exits perfectly, my array doesn't look like an array anymore ha! ha! I'm gonna try to put it back together but in line 41 and 43 it's not letting me have [] empty or nothing at all, it wants me to put the [] with something inside, I put zero so I could compile it but I know that it's not gonna work. Would you have any suggestions? Thank you so much!

public void setResultValue()
 {
   double principal = Double.parseDouble(mortgageText.getText());
   double term = Double.parseDouble(termText.getText());
   double interest = Double.parseDouble(intRateText.getText()) / 100.;
   double result = (principal * ( interest/12))/(1-( Math.pow (1/( 1 +(interest/12)), (term*12))));

 

   mPaymentText.setText(Double.toString(result));
}  
    public void actionPerformed(ActionEvent event) {
        Object objectPressed = event.getSource();

        if (objectPressed == calculateButton) {
            System.out.println("calculateButton pressed!");
            setResultValue();
        } else if (objectPressed == exitButton) {
            System.out.println("exitButton pressed!");
            System.exit(0);
        } else if (objectPressed == clearButton) {
            System.out.println("clearButton pressed!");

            termText.setText(null);
            intRateText.setText(null);
            mPaymentText.setText(null);
        } else if (objectPressed == rbOne) {
            System.out.println("rbOne pressed!");
        } else if (objectPressed == rbTwo) {
            System.out.println("rbTwo pressed!");
        } else if (objectPressed == rbThree) {
            System.out.println("rbThree pressed!");
        }
        
        {
        double[] annualInterests = {5.35, 5.5, 5.75}; //Interest Array
        int[] numOfYears = {7, 15, 30}; //Term Array 

        int i;
        
        double monthlyInterest = (double) (annualInterests [0] / (12 * 100));
        //J = monthly interest in decimal form = I / (12 x 100) 
        int totalNumOfMonths = (int) (numOfYears[0] * 12);//N = number of months over which loan is amortized = L x 12
        }

    }
}

I had something more like this in mind:

public void setResultValue()
 {
   // changed variable name from "principal" to "balance"
   double balance = Double.parseDouble(mortgageText.getText());

   double term = Double.parseDouble(termText.getText());
   double interest = Double.parseDouble(intRateText.getText()) / 100.;

   int numMonths = term * 12;
   double monthlyInterest = interest / 12.0;

   double monthlyPayment;
   // code to calculate monthly payment, put this into variable
   // monthlyPayment
   
   mPaymentText.setText(Double.toString(monthlyPayment));

   // code to calculate principal, balance, and interest for each
   // of numMonths payments and place each result into text box.
   // You may or may not decide to use an array for this.  I don't
   // think it is actually necessary.
}

  
    public void actionPerformed(ActionEvent event) {
        Object objectPressed = event.getSource();


        if (objectPressed == calculateButton) {
            System.out.println("calculateButton pressed!");
            setResultValue();
        } else if (objectPressed == exitButton) {
            System.out.println("exitButton pressed!");
            System.exit(0);
        } else if (objectPressed == clearButton) {
            System.out.println("clearButton pressed!");
            termText.setText(null);
            intRateText.setText(null);
            mPaymentText.setText(null);
        }

         else if (objectPressed == rbOne || objectPressed ==
                          rbTwo || objectPressed == rbThree)
          {
               int arrayIndex;

               if (objectPressed == rbOne) 
               {
                  System.out.println("rbOne pressed!");
                  arrayIndex = 0;
               }
               else if (objectPressed == rbTwo) 
               {
                  System.out.println("rbTwo pressed!");
                  arrayIndex = 1;
               }
               else if (objectPressed == rbThree) 
               {
                  System.out.println("rbThree pressed!");
                  arrayIndex = 2;
                }

                double[] annualInterests = {5.35, 5.5, 5.75}; //Interest Array
                int[] numOfYears = {7, 15, 30}; //Term Array 

                double annInterest = annualInterests[arrayIndex];
                int numYears = numOfYears[arrayIndex];

                intRateText.setText(Double.toString (annInterest));
                termText.setText(Integer.toString (numYears));
           }
        }

Note that all the calculations are still done in function SetResultValue. actionPerformed does not calculate but instead simply sets values and calls another function to do the real calculation work.

If Java gives you a hard time about not initializing arrayIndex, you can change line 45 to this:

int arrayIndex = 0;

Sometimes Java gets really picky about that.

This is what I have done so far. What do you think? It calculates, when I press the radio buttons it gives me the amount of 2859.79.... I'm not sure where is it pulling this calculation from but if I actually type the correct mortgage term and the interest rate it calculates it correctly. It still doesn't want to show the information on the text field. I'm not sure how to call it. You said if I was having problems calling the array to put int arrayIndex = 0; so I did. I thank you for your patience!

public void setResultValue() throws ParseException
 {
   double principal = Double.parseDouble(mortgageText.getText());
   double term = Double.parseDouble(termText.getText());
   double interest = Double.parseDouble(intRateText.getText()) / 100.;
   
   int numMonths = (int) (term * 12);
   double monthlyInterest = interest / 12.0;
   
   double MonthlyPayment = (principal * ( interest/12))/(1-( Math.pow (1/( 1 +(interest/12)), (term*12))));

    mPaymentText.setText(Double.toString(MonthlyPayment));
        int[] annualInterests = null;
    monthlyInterest = (annualInterests [0] / (12 * 100));
        int[] numOfYears = null;
//J = monthly interest in decimal form = I / (12 x 100) 
    int totalNumOfMonths = (int) (numOfYears[30] * 12);//N = number of months over which loan is amortized = L x 12
}  
    public void actionPerformed(ActionEvent event)  {
        Object objectPressed = event.getSource();

        if (objectPressed == calculateButton) {
            try {
                System.out.println("calculateButton pressed!");
                setResultValue();
            } catch (Exception ex) {

            }
        } else if (objectPressed == exitButton) {
            System.out.println("exitButton pressed!");
            System.exit(0);
        } else if (objectPressed == clearButton) {
            System.out.println("clearButton pressed!");

            termText.setText(null);
            intRateText.setText(null);
            mPaymentText.setText(null);
        } 
        
          else if (objectPressed == rbOne) {
            System.out.println("rbOne pressed!");
        } else if (objectPressed == rbTwo) {
            System.out.println("rbTwo pressed!");
        } else if (objectPressed == rbThree) {
            System.out.println("rbThree pressed!");
        }
        
        int arrayIndex = 0;
        double[] annualInterests = {5.35, 5.5, 5.75}; //Interest Array
        int[] numOfYears = {7, 15, 30}; //Term Array 

        
                double annInterest = annualInterests[arrayIndex];                
                int numYears = numOfYears[arrayIndex];                 
                intRateText.setText(Double.toString (annInterest));
                termText.setText(Integer.toString (numYears));           }

        }

Have you tried my suggestions from post 25? I still see the array in function SetResultValue in lines 13 and 15. In the actionPerformed you still have largely what you had last time. You have an arrayIndex variable in line 48, but your actionPerformed does not do anything with that variable. Check out my post # 25 from about 7 hours ago. I am assigning values to arrayIndex in the code blocks of the three radio buttons in actionPerformed then assigning the text fields based on the value of arrayIndex. arrayIndex thus needs to be declared higher in the function. The arrays based on the radio buttons are no longer in SetResultValue at all. The calculations that you had and have in actionPerformed have been moved back to SetResultValue. I think that is the better solution. Currently you are still assigning values in SetResultValue from both an array and from a text box (i.e. lines 8 and 14).

I'm so sorry I didn't see that. Thank you for pointing it out to me. I was getting really tired and I didn't notice it. I have changed it the way you said to do it. All of the radio buttons work and assigned the correct information and it calculates correctly. Please point out what else I'm missing. Thank Good I didn't have to work today or I would not have been able to do this. Thank you so much for your time.

public void setResultValue() throws ParseException
 {
      double balance = Double.parseDouble(mortgageText.getText());
      double term = Double.parseDouble(termText.getText());   
      double interest = Double.parseDouble(intRateText.getText()) / 100.;    
      int numMonths = (int) (term * 12);
      double monthlyInterest = interest / 12.0;

   
   double MonthlyPayment = (balance * ( interest/12))/(1-( Math.pow (1/( 1 +(interest/12)), (term*12))));

    mPaymentText.setText(Double.toString(MonthlyPayment));
       
        float paymentdue;    //    
}  
    public void actionPerformed(ActionEvent event)  {
        Object objectPressed = event.getSource();
        double interest = 0;

        if (objectPressed == calculateButton) {
            try {
                System.out.println("calculateButton pressed!");
                setResultValue();
            } catch (Exception ex) {

            }
        } else if (objectPressed == exitButton) {
            System.out.println("exitButton pressed!");
            System.exit(0);
        } else if (objectPressed == clearButton) {
            System.out.println("clearButton pressed!");

            termText.setText(null);
            intRateText.setText(null);
            mPaymentText.setText(null);
        } 

         else if (objectPressed == rbOne || objectPressed ==
                          rbTwo || objectPressed == rbThree)
          {
               int arrayIndex = 0;

               if (objectPressed == rbOne) 
               {
                  System.out.println("rbOne pressed!");
                  arrayIndex = 0;
               }
               else if (objectPressed == rbTwo) 
               {
                  System.out.println("rbTwo pressed!");
                  arrayIndex = 1;
               }
               else if (objectPressed == rbThree) 
               {
                  System.out.println("rbThree pressed!");
                  arrayIndex = 2;
                }

                double[] annualInterests = {5.35, 5.5, 5.75}; //Interest Array
                int[] numOfYears = {7, 15, 30}; //Term Array 

                double annInterest = annualInterests[arrayIndex];
                int numYears = numOfYears[arrayIndex];
                
                intRateText.setText(Double.toString (annInterest));
                termText.setText(Integer.toString (numYears));
           }
        }
}

I think you are O.K. I tested out your revised program and it appears to calculate the monthly payment correctly. Everything seems to be good. I have added on a bit to your SetResultValue function to calculate values. With the couple of tests I did, it looks like it works. You'll want to test more thoroughly obviously.

public void setResultValue() throws ParseException
{
      double balance = Double.parseDouble(mortgageText.getText());
      double term = Double.parseDouble(termText.getText());   
      double interest = Double.parseDouble(intRateText.getText()) / 100.;    
      int numMonths = (int) (term * 12);
      double monthlyInterest = interest / 12.0;
   
      double MonthlyPayment = (balance * ( interest/12))/(1-( Math.pow (1/( 1 +(interest/12)), (term*12))));

      mPaymentText.setText(Double.toString(MonthlyPayment));

      // clear the textArea box for clean output
      
      for (int i = 1; i <= numMonths; i++)
      {
          // three lines below calculate current row's values
          double interestPortion = balance * monthlyInterest;
          double principal = MonthlyPayment - interestPortion;
          balance = balance - principal;
 
          // code to place these 4 numbers into the GUI textArea.
          // I recommend creating a single string that contains 
          // the four variables (i, balance, principal, interestPortion,
          // formatted into constant width and truncated at 2 decimal
          // points.  Append this string to the textArea.
      }
}

Here's a link to Java's textArea functions. Scroll down for the "append" command as well as anything else that may be useful.
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/TextArea.html#append(java.lang.String)

The numbers appear correct to me. The correct number of payments occur and the ending balance is 0 (after round-off error). You'll need to somehow round off MonthlyPayment to the nearest cent. Thus due to round-off error, the final balance may be a couple of dollars rather than exactly 0, as in real life. Other than that, I think it's working. Your MonthlyPayment calculation seems to work. Otherwise the final balance would not have been 0.

To convince yourself that they are the right numbers, you may consider displaying some of those values calculated to the console using some System.out.println commands to the screen (as you have in the actionPerformed).

Other than that, fine tune it, round the numbers off to the nearest cent, format so the numbers line up, stick 'em in the textArea, and you're pretty much done. See comments I put in the code I just posted.

commented: You are a great teacher!!! The best!! +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.