Explore BrainMass

Explore BrainMass

    Java Programming Mortgage

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Please help me create a GUI with 3 JTextField (one for loan amount, one for term, and one for interest rate), one JTextArea (where the monthly payment schedule will be displayed; appended for each month, for all moths; attach a JScrollPane to the JTextArea), one JComboBox (with 3 selections: 7 year at 5.35%, 15 year at 5.5 %, 30 year at 5.75%), and 3 JButton (one for computing the monthly payment schedule, one for resetting all fields, and one for exit the application). The user should be able to input in the text fields the loan amount, interest rate, and term, or input the loan amount in a text field and then select from the combo box the type of loan.

    © BrainMass Inc. brainmass.com October 9, 2019, 7:48 pm ad1c9bdddf


    Solution Preview

    Please see the attached file.

    // Mortgage.java

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

    public class Mortgage extends JApplet {
    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 termLabel=new JLabel("Term: ");
    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: ");
    private JLabel payment=new JLabel();
    private JButton calculate=new JButton("Calculate");
    private JButton clear=new JButton("Clear");
    private JButton exit=new JButton("Exit");
    private JTextArea paymentSchedule=new JTextArea();
    private JScrollPane schedulePane=new JScrollPane(paymentSchedule);
    private Container cp = ...

    Solution Summary

    This solution helps with java programming.