Java Calculator
Below is one of our free research papers on Java Calculator. 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.
Java Calculator
/*
Mortgage Calculator
Date: April 16, 2008
Filename: MortgageCalc.java
Purpose: This is a program to calculate the mortgage using user input.
*/
import java.awt.*;
import java.awt.event.*;
import java.awt.datatransfer.*;
import java.text.DecimalFormat;
import javax.swing.JOptionPane;
public class MortgageCalc extends Frame implements ActionListener
{
private Button keys[];
private Panel userInterface, buttonInterface, result1Interface, result2Interface;
private TextField tfMortgagePayment, tfMortgageAmount;
private TextArea tfMonthlyPayments;
private Label label1, label2, label3, label4;
private Choice availableLoans;
private double mortgagePayment, loanBalance=0;
private boolean foundKey;
private DecimalFormat roundDecimal;
private double [] intRateAnnual = {5.35, 5.50, 5.75};
private int termMonths, arrayIndex=0;
private int [] termYears = {7, 15, 30};
//MortgageCalc constructor
public MortgageCalc() //throws IOException
{
roundDecimal = new DecimalFormat("########.##");
// create an instance of the menu
MenuBar mnuBar = new MenuBar();
setMenuBar(mnuBar);
// construct and populate the File menu
Menu mnuFile = new Menu("File", true);
mnuBar.add(mnuFile);
MenuItem mnuFileExit = new MenuItem("Exit");
mnuFile.add(mnuFileExit);
// construct and populate the Edit menu
Menu mnuEdit = new Menu("Edit", true);
mnuBar.add(mnuEdit);
MenuItem mnuEditClear = new MenuItem("Clear");
mnuEdit.add(mnuEditClear);
// construct and populate the About menu
Menu mnuAbout = new Menu("About", true);
mnuBar.add(mnuAbout);
MenuItem mnuAboutCalculator = new MenuItem("Mortgage Calculator");
mnuAbout.add(mnuAboutCalculator);
// add the ActionListener to each menu item
mnuFileExit.addActionListener(this);...
- Submitted by: czenrezig
- Date Submitted: 04/29/2008 01:43 PM
- Category: Technology
- Words: 972
- Pages: 4
- Views: 1504
- Rank: 7644