Mortgages_Cal
Week 4 Assignment
David Moak
University of Phoenix
Computer Programming I
POS/406
Instructor: Mr. Jim Leadbeter
June 7, 2007
Week 4 Assignment
/* ----------------------------------------------
* Mortgage Program
* Student: David Moak
* Class Date: June 7, 2007
* Course Title: University of Phoenix POS 406
* Instructor: Mr. Jim Leadbeter
* ----------------------------------------------
*/
import java.awt.*; // User interface classes
import java.io.*;
import java.awt.event.*; // Event handling
import java.text.*; // Text formatting
import java.math.*; // Math
public class Mortgage_Calc_W4
{
// Define a button listener
private static class ButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent event)// Event handler method
{
outputLabel.setText ("See Output Window");
DecimalFormat currency_format = new DecimalFormat("0.00");
Loan_Amount = Double.parseDouble(inputMort.getText()); // Principal - amount of full loan
double Interest = Double.parseDouble(inputIntRate.getText());
double Length_of_Loan = Double.parseDouble(inputYears.getText());
double Monthly_Interest = Interest / (12 * 100); // Monthly interest
int Number_of_Months = (int) Length_of_Loan * 12; // Total # of months
double Monthly_Payment = (double) (Loan_Amount * (Monthly_Interest / (1 - (Math.pow((1 + Monthly_Interest), -Number_of_Months)))));
double MortAMT = Double.parseDouble(inputMort.getText());
String Monthly_Payment_String = NumberFormat.getCurrencyInstance().format(Monthly_Payment);
String Monthly_Interest_String = String.valueOf(Monthly_Interest);
// Strings for output
String lineOne; // Strings to hold...
Please login to view the full essay...