Pos 407 Week 2
Below is one of our free research papers on Pos 407 Week 2. If the term paper below is not exactly what you're looking for, you can search our essay database for other topics or order a custom essay.
Pos 407 Week 2
//Week2 Nicholas Zarnin
/*
Week 2: Mortgage Calculator
Programmer: Nicholas Zarnin
Date: June 11, 2006
Filename: Mortgage.java
Purpose: This program accepts input from a user for principal amount, term, and interest rate, and calculates the payment. This program allows users to enter new information, or exit the program
*/
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.Locale;
import java.text.*;
class Mortgage extends JFrame
implements ActionListener {
JButton Calculate;
JButton Reset;
// What the text box is.
JLabel loanLabel;
JLabel interestLabel;
JLabel yearsLabel;
JLabel paymentLabel;
//Where user Inputs Data, and results too!
JTextField loanTextbox;
JTextField interestTextbox;
JTextField yearsTextbox;
JTextField paymentTextbox;
JTextField paymentfield;
//Set the variables to 0, ready for input
double amount=0;
double years=0;
double interest=0;
double totalpayments=0;
double monthly_interest_rate=0;
double monthly_payment=0;
double totalcalc=0;
//Currency Information for regional formatting
NumberFormat curr = NumberFormat.getCurrencyInstance(Locale.US);
// This is where the form all comes together
public Mortgage (int width, int height)
{
this.setTitle ("Nick's Mortgage Calculator");
this.setResizable (true);
this.setSize (400, 400);
this.setLocationRelativeTo(null);
//This is how its going to close
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container cPane = this.getContentPane();
cPane.setLayout (new GridLayout(0,2));
//The Calculate and reset botton
Calculate = new JButton ("Calculate");
Calculate.addActionListener (this);
cPane.add (Calculate);
Reset = new JButton("Reset");
Reset.addActionListener (this);
cPane.add (Reset);
//This is where I declare the Fields and the Labels for the GUI
loanLabel = new JLabel ("Loan...
- Submitted by: acab9759
- Date Submitted: 06/25/2006 12:43 PM
- Category: Technology
- Words: 758
- Pages: 4
- Views: 731
- Rank: 72288