Purchase Solution

Modified Mortgage Calculator Problem

Not what you're looking for?

Ask Custom Question


Write an Exception class called MortgageInputexception.java. this class will inherit from the Exception.class in the java API. The exception should be packaged in the src.calculator.gui package.

Modify MortgagedisplayGui.java to include a function called is ValidRate(String testValue) is Valid Term(String testValue) is ValidLoanAmount(String testValue) that will interrogate an input value for each of the entries, rate, term and loan amount. This function will throw the MortgageInputException if the entry is not valid. Use the String manipulation functions to determine if the content is appropriate. That is, the entry does not contain special characters and letters, and for rate does meet the format the calculator requires in order to use the rate in the equations.

Modify MortgageDisplayGui.java to try and catch for this MortgageInputException 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.

The new validation functions should throw the exception MortgageInputException.

Include in MortgagedisplayGui.java:

public static final String Rate_Error_MSG;
public static final String Amount_Error_MSG;
public static final String Term_Error_MSG;

private void calculate() {

isValidRate(in testValue : String) : double
is ValidLoanAmount(in testValue : String) : double
is ValidTerm(in testValue : String) : double
displayError(in message : String)

Purchase this Solution

Solution Summary

The modified mortgage calculator problems are analyzed. The string manipulation functions to determine if the content is appropriate is determined.

Purchase this Solution

Free BrainMass Quizzes
C++ Operators

This quiz tests a student's knowledge about C++ operators.

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.

Excel Introductory Quiz

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

C# variables and classes

This quiz contains questions about C# classes and variables.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.