Explore BrainMass
Share

# Mortgage Calculator Modification

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

Modify the mortgage program to display 3 mortgage loans: 7 year at 5.35%, 15 year at 5.5 %, and 30 year at 5.75%. Use an array for the different loans. Display the mortgage payment amount for each loan. Then, list the loan balance and interest paid for each payment over the term of the loan. Use loops to prevent lists from scrolling off the screen. Do not use a graphical user interface. Insert comments in the program to document the program.

Please use the following to build upon

import java.io.*;
import java.util.Date;
import java.text.DecimalFormat;

public class Mortgage4
{
public static void main(String[] args)
{
Date currentDate = new Date(); //Date constructor
DecimalFormat decimalPlaces=new DecimalFormat("0.00");

//declaring variables
final double PRINCIPLE = 200000;
final double INTEREST = .0575;
final double TERM = 12*30;
final double MonthlyInterest = INTEREST/12;

//declaring variables
final double MONTHLY = (PRINCIPLE/ ((Math.pow((1 + MonthlyInterest), TERM) -1) / (MonthlyInterest * Math.pow((1 + MonthlyInterest), TERM))));
//displaying variables
System.out.println("tt" + currentDate);
System.out.println("ttPrinciple or Loan Amount: " + PRINCIPLE);
System.out.println("ttInterest Rate: " + INTEREST);
System.out.println("ttThe Term of Loan (in months): " + TERM);
System.out.println("ttThe Monthly Payment is: \$" + decimalPlaces.format(MONTHLY));
//System.out.println(decimalPlaces.format(MONTHLY));
}
}

https://brainmass.com/computer-science/user-interface/168900

#### Solution Preview

Hi,

Thanks
Baseraj Mathew K

UPDATING:

Dear friend,

I have done the ...

#### Solution Summary

This solution provides a program that acts as a mortgage calculator.

\$2.19

## JAVA PROBLEM: MORTGAGE CALCULATOR MODIFICATION If possible for ota 104485

ADDED CHANGES NEED FOR PROBLEM AND INCREASED BID TO 15.
Also, the program should not except a neg number.

1. Modify the ScheduleDialog.java to have a button panel that will save the output to a file, read and display file content, and clear the text area:

Write a class DataIOException.java that implements Throwable;

Write an Interface called Amortization TableInterface that retrieves data for the amortization table.
The interface should provide the functions
Public Row[] getData() throws DataIOException;

Write a concrete class called Amortization TableInterfaceImpl that implements these functions, by reading and writing the Row[] to a file and from a file, via the getData and setData interface functions

CHANGE: Place class in UTIL and remove DATA file..
Store the Interface, Exception and concrete class in the package src.calculator.data

2. Modify the ScheduleDialog.java:
-class to include a new JPanel for the buttons, similar to the one in the main GUI
-have the ScheduleDialog., implement action listener

Write the actionPerformed function to interrogate the Event object and determine which button is responsible for the event and call one of three functions: readSchedule(), saveSchedule(), clearView().

Make sure that the clear and the write buttons are disabled if there is no content in the display and enabled if there is content.

Try and catch for DataIOException and upon error, report the Error to the user via a JoptionPane using the ERROR_MESSAGE and DEFAULT_OPTION constants provided by the JoptionPane class

3. Modify the MortgageDisplayGui.java:

Include a member of the Amortization TableInterfaceImpl tableInterface.

Add a new constructor to the MortgageDisplayGui to accept the tableInterface

Public MortgageDisplayGui(Amortization TableInterfacelmpl tableInterface)

LAST MINUTE CHANGES:

so in MortgageDisplayGui

1. create another in the class

JButton dataButton;

2. in the init() functions

dataButton = new JButton("Data");

3. in the actionPerformed(ACtionEvent ev);

//add another if statement when checking buttons
if( == dataButton)
{
viewData()
}

4. write a viewData() functions that

pubic void viewData(){

// use the scheduleDialog variable to just set the dialog visible.
// the dialog should appear with a blank field and your 3 buttons
scheduleDialog.setVisible(true);
}

View Full Posting Details