ReviewEssays.com - Term Papers, Book Reports, Research Papers and College Essays
Search

Mortgage Calculator Week 3

Essay by   •  December 21, 2010  •  Research Paper  •  478 Words (2 Pages)  •  1,497 Views

Essay Preview: Mortgage Calculator Week 3

Report this essay
Page 1 of 2

/* 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);

exitMenuItem.setActionCommand("Exit");

fileMenu.add(exitMenuItem);

menuBar.add(fileMenu);

editMenu.setText("Edit");

clearMenuItem.setText("Clear");

clearMenuItem.addActionListener(this);

clearMenuItem.setActionCommand("Clear");

editMenu.add(clearMenuItem);

menuBar.add(editMenu);

aboutMenu.setText("About");

aboutMenuItem.setText("About Calculator");

aboutMenuItem.addActionListener(this);

aboutMenuItem.setActionCommand("About");

aboutMenu.add(aboutMenuItem);

menuBar.add(aboutMenu);

setJMenuBar(menuBar);

//Create input boxes and set background color to white

loanInput = new JTextField(10);

loanInput.setText("");

loanInput.setHorizontalAlignment(javax.swing.JTextField.TRAILING);

loanInput.setBackground(Color.white);

loanInput.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));

payment = new JTextField(15);

payment.setText("0.00");

payment.setHorizontalAlignment(javax.swing.JTextField.TRAILING);

...

...

Download as:   txt (8.5 Kb)   pdf (120.2 Kb)   docx (12.2 Kb)  
Continue for 1 more page »
Only available on ReviewEssays.com