Explore BrainMass
Share

Explore BrainMass

    Java mortgage calculator: printing amortization table

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

    Modify the given Java Mortgage Calculator to print an Amortization Table for each of the three loans. It should pause briefly after each screen-full of lines (i.e. every 30 lines) before continuing, to allow the user to read the data.

    Also provided are the formulas that need to be used, and the pseudo-code for the calculation process.

    © BrainMass Inc. brainmass.com October 10, 2019, 12:27 am ad1c9bdddf
    https://brainmass.com/computer-science/java/java-mortgage-calculator-printing-amortization-table-292631

    Attachments

    Solution Preview

    Please find attached 292631-MortgagePayment.java that adds a function to your existing Java code to print amortization table, following the formulas provided by you. Rename it as MortgagePayment.java before attempting to compile and run it. This code sleeps for 5 seconds after every 30 lines of same table, and after completely printing the table if number of lines in table are not multiple of 30. Please adjust the pause timing to suit your need.

    Since nothing is specified about the amortization table columns, this code prints "Month number", "Principal Payment", "Interest Payment", "Loan Balance" and "Principal Balance" columns, though all the information is computed as per your "Mortgage Formulas.docx". I hope you can easily add/change columns in printed table to meet your requirement.

    import java.text.DecimalFormat;

    public class MortgagePayment {
    private int principle;
    private int notePeriod;
    private float interestRate;

    /**
    * Constructor for Mortgage Payment
    *
    * @param principle
    * - loan principle
    * @param notePeriod
    * - number of months ...

    Solution Summary

    Since nothing is specified about the amortization table columns, the modified code prints "Month number", "Principal Payment", "Interest Payment", "Loan Balance" and "Principal Balance" columns, though all the information is computed as per the given "Mortgage Formulas.docx".

    $2.19