1

Can you help with Mortgage Calculator in Java?

-

Here’s my assignment? Write the program in Java (with a graphical user interface) and have it calculate and display the mortgage payment amount from user input of the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage. Allow the user to loop back and enter new data or quit. Please insert comments in the program to document the program.

I’m still getting errors! (see below) mortgage rate calculator

package MortCalc2.java ;

/**
*
* @author alesiab
*/
//Declaration of class
public class MortCalc2{

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}

}
//Declaration of class
/**
* @param args the command line arguments
*/

// Declaration of labels
import JPanel row1 = new JPanel(new GridLayout(1, 3));
import JLabel principal_label1 = new JLabel("Net Amount $ :", JLabel.LEFT);//Sets label text and alignment
JTextField principal_txt = new JTextField(10);
JPanel row2 = new JPanel(new GridLayout(1, 3));
JLabel term_label2 = new JLabel("Term Yrs :", JLabel.LEFT);
JTextField term_txt = new JTextField(10);
JPanel row3 = new JPanel(new GridLayout(1, 3));
JLabel rate_label3 = new JLabel("Interest Rate %:", JLabel.LEFT);
JTextField rate_txt = new JTextField(10);
JPanel row4 = new JPanel(new GridLayout(1, 3));
JLabel pay_label4 = new JLabel("Monthly Payment $:", JLabel.LEFT);
JTextField pay_txt = new JTextField(10);
JPanel button = new JPanel(new FlowLayout(FlowLayout.CENTER));

//Declaration of buttons and text shown on them
JButton rstButton = new JButton("Reset");
JButton extButton = new JButton("Exit");
JButton calcButton = new JButton("Calculate");

//Declaration for area to display user input
JTextArea displayArea = new JTextArea(10, 45);

// Declaration of number formats that will be output after calculation
DecimalFormat twodigits = new DecimalFormat("#,###.00");

//Declaration of variables
double rate = 0;//Sets rate as a double set to zero
double mpay = 0;//Sets monthly payment as a double set to zero
double principal = 0;//Sets principal as a double set to zero
int term = 0;//Sets interest as a integer set to zero
double interest = 0;//Sets interest as a double set to zero

//Declaration of constructor
public MortCalc2() {

super("Mortgage Calculator: SR-mf-003 #4");//Syntax used for calling constructor
setSize(400, 200);//sets size of the constructor
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//clears all info and closes window
Container pane = getContentPane();//returns the value for content
Border bdr = new EmptyBorder(2, 5, 2, 5);//provides borders for label

//Declaration of windows that will hold users input

pane.add(row1);
row1.add(principal_label1);
row1.add(principal_txt);
row1.setMaximumSize(new Dimension(300, 25));
row1.setBorder(bdr);

pane.add(row2);
row2.add(term_label2);
row2.add(term_txt);
row2.setMaximumSize(new Dimension(300, row2.getMinimumSize().height));
row2.setBorder(bdr);

pane.add(row3);
row3.add(rate_label3);
row3.add(rate_txt);
row3.setMaximumSize(new Dimension(300, row3.getMinimumSize().height));
row3.setBorder(bdr);

pane.add(row4);
row4.add(pay_label4);
row4.add(pay_txt);
row4.setMaximumSize(new Dimension(300, row4.getMinimumSize().height));
row4.setBorder(bdr);

button.add(calcButton);
button.add(rstButton);
button.add(extButton);
pane.add(button);

pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
setVisible(true);
setContentPane(pane);

button.setMaximumSize(new Dimension(10000, button.getMinimumSize().height));

//Adds specified action listener to get action events from buttons
rstButton.addActionListener(this);
extButton.addActionListener(this);
calcButton.addActionListener(this);
}
//Declaration of calculation actions to take place

public void actionPerformed(ActionEvent event) {

Object source = event.getSource();
//Begin "if" function
if (source == calcButton) // calculates on hit
{
validateUserInput(principal_txt, rate_txt, term_txt); // validates input

//formula for calculation output
mpay = principal * (rate / (12 * 100)) / (1 – Math.pow(1 + (rate / (12 * 100)), -1 * (term * 12)));
pay_txt.setText("" + twodigits.format(mpay));
}

if (source == rstButton) // Clears on hit
{
term_txt.setText(" ");
rate_txt.setText(" ");
principal_txt.setText(" ");
pay_txt.setText(" ");
displayArea.setText(" ");
}

if (source == extButton) // Exits on hit
{

System.exit(0);
}

}//end action

//Declaration of the main method
public static void main(String[] arguments) {
MortCalc2 mtg = new MortCalc2();

}
//Declaration of user input for each variable

public void validateUserInput(JTextField principal_txt, JTextField rate_txt, JTextField term_txt) {
//Begin "try/catch" function
try {

principal = Double.parseDouble(principal_txt.getText());

} catch (NumberFormatException e)//Action listener
{
/

There was a lot wrong with this. You had duplicate main methods, you tried to import while making a variable declaration (which would be a handy feature I suppose, but is invalid in Java), and forgot to extend the JFrame class and implement ActionListener. I fixed these and some other issues so that it would compile. Getting the logic to work is up to you though.

/** @author alesiab
*/

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DecimalFormat;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;

//Declaration of class
public class MortCalc2 extends JFrame implements ActionListener {

// Declaration of labels
JPanel row1 = new JPanel( new GridLayout( 1, 3 ) );
JLabel principal_label1 = new JLabel( "Net Amount $ :", JLabel.LEFT );// Sets label text and alignment
JTextField principal_txt = new JTextField( 10 );
JPanel row2 = new JPanel( new GridLayout( 1, 3 ) );
JLabel term_label2 = new JLabel( "Term Yrs :", JLabel.LEFT );
JTextField term_txt = new JTextField( 10 );
JPanel row3 = new JPanel( new GridLayout( 1, 3 ) );
JLabel rate_label3 = new JLabel( "Interest Rate %:", JLabel.LEFT );
JTextField rate_txt = new JTextField( 10 );
JPanel row4 = new JPanel( new GridLayout( 1, 3 ) );
JLabel pay_label4 = new JLabel( "Monthly Payment $:", JLabel.LEFT );
JTextField pay_txt = new JTextField( 10 );
JPanel button = new JPanel( new FlowLayout( FlowLayout.CENTER ) );

// Declaration of buttons and text shown on them
JButton rstButton = new JButton( "Reset" );
JButton extButton = new JButton( "Exit" );
JButton calcButton = new JButton( "Calculate" );

// Declaration for area to display user input
JTextArea displayArea = new JTextArea( 10, 45 );

// Declaration of number formats that will be output after calculation
DecimalFormat twodigits = new DecimalFormat( "#,###.00" );

// Declaration of variables
double rate = 0;// Sets rate as a double set to zero
double mpay = 0;// Sets monthly payment as a double set to zero
double principal = 0;// Sets principal as a double set to zero
int term = 0;// Sets interest as a integer set to zero
double interest = 0;// Sets interest as a double set to zero

// Declaration of constructor
public MortCalc2() {

super( "Mortgage Calculator: SR-mf-003 #4" );// Syntax used for calling constructor
setSize( 400, 200 );// sets size of the constructor
setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
Container pane = getContentPane();// returns the value for content
Border bdr = new EmptyBorder( 2, 5, 2, 5 );// provides borders for label

// Declaration of windows that will hold users input
pane.add( row1 );
row1.add( principal_label1 );
row1.add( principal_txt );
row1.setMaximumSize( new Dimension( 300, 25 ) );
row1.setBorder( bdr );

pane.add( row2 );
row2.add( term_label2 );
row2.add( term_txt );
row2.setMaximumSize( new Dimension( 300, row2.getMinimumSize().height ) );
row2.setBorder( bdr );

pane.add( row3 );
row3.add( rate_label3 );
row3.add( rate_txt );
row3.setMaximumSize( new Dimension( 300, row3.getMinimumSize().height ) );
row3.setBorder( bdr );

pane.add( row4 );
row4.add( pay_label4 );
row4.add( pay_txt );
row4.setMaximumSize( new Dimension( 300, row4.getMinimumSize().height ) );
row4.setBorder( bdr );

button.add( calcButton );
button.add( rstButton );
button.add( extButton );
pane.add( button );

pane.setLayout( new BoxLayout( pane, BoxLayout.Y_AXIS ) );
setVisible( true );
setContentPane( pane );

button.setMaximumSize( new Dimension( 10000, button.getMinimumSize().height ) );

// Adds specified action listener to get action events from buttons
rstButton.addActionListener( this );
extButton.addActionListener( this );
calcButton.addActionListener( this );
}

// Declaration of calculation actions to take place

public void actionPerformed( ActionEvent event ) {
Object source = event.getSource();
// Begin "if" function
if( source == calcButton ) // calculates on hit
{
validateUserInput( principal_txt, rate_txt, term_txt ); // validates input
// formula for calculation output
mpay = principal * ( rate / ( 12 * 100 ) ) / ( 1 – Math.pow( 1 + ( rate / ( 12 * 100 ) ), -1 * ( term * 12 ) ) );
pay_txt.setText( "" + twodigits.format( mpay ) );
}

if( source == rstButton ) // Clears on hit
{
term_txt.setText( " " );
rate_txt.setText( " " );
principal_txt.setText( " " );
pay_txt.setText( " " );
displayArea.setText( " " );
}
if( source == extButton ) // Exits on hit
{
System.exit( 0 );
}
}// end action

// Declaration of the main method
public static void main( String[] arguments ) {
MortCalc2 mtg = new MortCalc2();
}

// Declaration of user input for each variable
public void validateUserInput( JTextField principal_txt, JTextField rate_txt, JTextField term_txt ) {
// Begin "try/catch" function
try {
principal = Double.parseDouble( principal_txt.getText() );
} catch( NumberFormatException e )// Action listener
{
}
}
}

0

online mortgage rate calculator

-

mortgage rate calculator online mortgage rate calculator

http://onlinemortgageratecalculator.blogspot.in/

we provide information about home mortgage refinancing loans online apply with rate of interest mortgage calculators.Typically home refinancing is done when you have a mortgage on your home and apply for a second loan to pay off the first one.

Visit the website for full information
http://onlinemortgageratecalculator.blogspot.in/

Duration : 0:1:20

(more…)

Technorati Tags: , , ,

1

What Low Mortgage Rates and Payment Calculators don’t tell you. Mortgage Myths Revealed…

-

mortgage rate calculator http://autorefinanceloanrate.org/ Finanace a new car today at a low rate!!

Duration : 0:9:13

(more…)

Technorati Tags: , , , , ,

1

Will the APR always be higher than the quoted rate for a 30 year mortgage?

-

I’ve noticed in some APR calculators specifically for fixed rate products that when a higher APR is chosen such that the mortgage company pays you points to take that higher rate, the quoted APR may be lower than the actual rate?
Is that correct or is there an issue with the APR calculation?

APR would always be higher because it also factors in the fees you pay to get the loan as part of the interest cost.

0

Refinance Home | (816) 559-7944 | Refinance Mortgage Calculator | The Right One | Kansas City 64114

-

mortgage rate calculator Refinance Kansas City, MO (816) 559-7944

(816) 559-7944 – The White House has made available its newest proposal to help overwhelmed homeowners refinance their mortgages to lower interest rates. If you are a homeowner or not, you’ve probably noticed a lot of discussion about mortgage refinance. Refinancing your mortgage can help you to achieve the following:

* You can lessen your monthly mortgage payments by taking advantage of lower interest rates.
* You can make the same payment and decrease the length of your mortgage to pay it off faster, saving on interest charges.
* You could also increase the length of your mortgage thereby spreading out the costs for more affordable monthly payments.
* You could change from an adjustable rate mortgage to a fixed-rate mortgage or vice versa.
* You could also refinance your home for a higher loan amount to get funds for expenses, renovations or college tuition.

When you first purchased your home, your interest rates were determined by the financial environment and factors like your credit rating and the size of your down payment.

Typically your financial situation has improved over time and interest rates may be lower, so you could likely benefit by trading up to a better mortgage with a refinance of your home.

It can be confusing and even intimidating to know exactly when to refinance, what are the best approachs to take, what benefits to expect, and whether or not the cost and time are ultimately worth the end result. If this is your first home, this process may cause you undue worry as you are still shell-shocked from the process of getting your first mortgage.

There may also be substantial costs involved and you will want to take these into account while you weigh whether a refinance can save you money.

Don’t worry, we are here to help you through the whole process

refinance Kansas City,mortgage refinance Kansas City,refinance mortgage Kansas City,home refinance Kansas City,mortgage refinancing Kansas City,refinancing mortgage Kansas City,when to refinance Kansas City,refi Kansas City,home refinancing Kansas City,how to refinance a mortgage Kansas City,refinance home Kansas City,refinance rate Kansas City,refinancing a mortgage Kansas City,refinance loan Kansas City,should i refinance Kansas City,refinance mortgage rates Kansas City,home affordable refinance program Kansas City,refin Kansas City,mortgage refinance rates Kansas City,fha refinance Kansas City,fha streamline refinance Kansas City,refinance NKC MO,mortgage refinance NKC MO,refinance mortgage NKC MO,home refinance NKC MO,mortgage refinancing NKC MO,refinancing mortgage NKC MO,when to refinance NKC MO,refi NKC MO,home refinancing NKC MO,how to refinance a mortgage NKC MO,refinance home NKC MO,refinance rate NKC MO,refinancing a mortgage NKC MO,refinance loan NKC MO,should i refinance NKC MO,refinance mortgage rates NKC MO,home affordable refinance program NKC MO,refin NKC MO,mortgage refinance rates NKC MO,fha refinance NKC MO,fha streamline refinance NKC MO,refinance Clay County,mortgage refinance Clay County,refinance mortgage Clay County,home refinance Clay County,mortgage refinancing Clay County,refinancing mortgage Clay County,when to refinance Clay County,refi Clay County,home refinancing Clay County,
how to refinance a mortgage Clay County,refinance home Clay County,refinance rate Clay County,refinancing a mortgage Clay County,refinance loan Clay County,should i refinance Clay County,
refinance mortgage rates Clay County,home affordable refinance program Clay County,refin Clay County,mortgage refinance rates Clay County,fha refinance Clay County,fha streamline refinance Clay County,refinance 64114,mortgage refinance 64114,refinance mortgage 64114,home refinance 64114,mortgage refinancing 64114,refinancing mortgage 64114,when to refinance 64114,refi 64114,home refinancing 64114,how to refinance a mortgage 64114,refinance home 64114,refinance rate 64114,refinancing a mortgage 64114,refinance loan 64114,should i refinance 64114,refinance mortgage rates 64114,home affordable refinance program 64114,refin 64114,mortgage refinance rates 64114, fha refinance 64114,fha streamline refinance 64114,refinance 64151,line of credit,credit line,house loan,house loans,mortgage loan,mortgage loans,home financing,reverse mortgage,home mortgage loan,home loan mortgage,closing costs,mortgage broker,lines of credit mortgage refinance 64151,refinance mortgage 64151,home refinance 64151,mortgage refinancing 64151,refinancing mortgage 64151,when to refinance 64151,refi 64151,home refinancing 64151,how to refinance a mortgage 64151,refinance home 64151,refinance rate 64151,refinancing a mortgage 64151,refinance loan 64151,should i refinance 64151,refinance mortgage rates 64151,home affordable refinance program 64151

Duration : 0:1:9

(more…)

Technorati Tags: , , , , , , , , , , , , , , , , , , , , , , , , , ,

1

Online Mortgage Payment Calculator?

-

I need an online mortgage payment calculator where you can input the following:
Mortgage Amount (Example: 10,000 dollars)
Mortgage Term (Example: 1 year/12 months)
Interest Rate: (Example: 10.2%)
Monthly Payment (Example: $200)

The calculator needs to show a table of results including:

Monthly Balance
Interest on Unpaid Balance
Total (Monthly balance + monthly interest)
Monthly Payment (in my case it’s $200 per month)
and the Balance after all that. (Total Balance per month: monthly balance + monthly interest – $200)
All of that for each of 12 months, and then the grand total last.

If there is such thing, the first person to locate a calculator where you can input the monthly balance (not have it calculated) gets Best Answer.

I’m asking this cuz I’ve only seen Mortgage Calculators which calculate your monthly payment. I need one which calculates all/ most of the functions I listed above. Thanx!
If you can calculate everything i listed & put it in a graph yourself, even better!
By the way, the mortgage stuff is for a project, not in a real situation…..

Try bankrate.com. You can play around with in adding extra payments, interest rates, and terms. I can’t imagine a $200 mortgage anywhere in the US.