Purchase Solution

Java Mortgage Calculator

Not what you're looking for?

Ask Custom Question

Write a program in Java (with a graphical user interface) that calculates and displays the mortgage payment amount from user input of the amount of the mortgage and the user's selection from a menu of available mortgage loans:

- 7 years at 5.35%
- 15 years at 5.5%
- 30 years at 5.75%

Use an array for the mortgage data for the different loans. Display the mortgage payment amount followed by the loan balance and interest paid for each payment over the term of the loan. Allow the user to loop back and enter a new amount and make a new selection or quit.

Purchase this Solution

Solution Summary

Solution contains java source code file that has been compiled and tested. A simple graphical user interface form is provided to intake the mortgage parameters such as loan amount and terms. Monthly payments and balances are calculated and displayed.

Solution Preview

Please find attached Java file Mortgage.java .

Note, once the form opens you should enter loan amount and select a drop down term and the other fields will be populated (years, rate) automatically from the values defined in the arrays as required. You can also type in values manually if you like.

You can run the program using Java SDK as follows.

To compile the program:
javac.exe -g Mortgage.java

To run the program:
java.exe Mortgage

Source Code:
======================================

// Mortgage.java

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.*;

public class Mortgage extends JFrame {
private String[] terms={"7","15","30"};
private double[] rates={0.0535,0.055,0.0575};
private JLabel amountLabel=new JLabel("Loan amount: ");
private JTextField amount=new JTextField();
private JLabel termSelLabel=new JLabel("Select Term: ");
private JLabel termLabel=new JLabel("Years: ");
private JTextField term=new JTextField();
private JLabel rateLabel=new JLabel("Interest rate: ");
private JTextField rate=new JTextField();
private JComboBox termList = new JComboBox(terms);
private JLabel payLabel=new JLabel("Monthly Payment: ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Javscript Basics

Quiz on basics of javascript programming language.