Mortgage Calculator Week 3
By: Venidikt • Study Guide • 478 Words • November 18, 2009 • 886 Views
Essay title: Mortgage Calculator Week 3
/* Week3 Individual Assignment
* This program has been developed
* to calculate data inputed by the
* user to figure monthly payments
* based on available
mortgage loans.
*
* Version 1 Created 9/16/06 by Richard Shreve
* Version 2 Created 9/22/06 by Richard Shreve
*
*/
// Import required classes
import java.text.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.Math.*;
import javax.swing.*;
public class MortgageCalculator_v2 extends JFrame implements ActionListener{
//Define calculation variables
double a, x, y, z, m;
//Font type for companyname label
Font bigFont = new Font("Times New Roman", Font.ITALIC, 24);
//Label items
JLabel companyname = new JLabel(" McBride Mortgage Calculator");
JLabel loanamount = new JLabel("Enter loan amount: $ ");
JLabel terminterest = new JLabel("Select term and interest rate:");
JLabel monthly = new JLabel("Monthly payment amount:");
JLabel picture;
//Text feilds for entering and displaying desired data
JTextField loanInput;
JTextField payment;
//Buttons to calculate
and clear the form
JButton calculate;
JButton clear;
//Radio buttons to make term and interest rate selections
JRadioButton selection1;
JRadioButton selection2;
JRadioButton selection3;
//List of monthly payments and interest paid per month
JScrollPane amortized;
//Decimal format
DecimalFormat decimal = new DecimalFormat("0.00");
//Menu Items
private javax.swing.JMenu aboutMenu;
private javax.swing.JMenuItem aboutMenuItem;
private javax.swing.JMenuItem clearMenuItem;
private javax.swing.JMenu editMenu;
private javax.swing.JMenuItem exitMenuItem;
private javax.swing.JMenu fileMenu;
private javax.swing.JMenuBar menuBar;
public MortgageCalculator_v2(){
//Create container to hold panels
Container content = getContentPane();
//Create menu bar
menuBar = new javax.swing.JMenuBar();
fileMenu = new javax.swing.JMenu();
exitMenuItem = new javax.swing.JMenuItem();
editMenu = new javax.swing.JMenu();
clearMenuItem = new javax.swing.JMenuItem();
aboutMenu = new javax.swing.JMenu();
aboutMenuItem = new javax.swing.JMenuItem();
fileMenu.setText("File");
exitMenuItem.setText("Exit");
exitMenuItem.addActionListener(this);