CPSC 120 Postlab 5: Mortgage Calculator
Due Before Class on Monday October 10
The CS Bank International has asked you write a program to simplify the job
of their mortgage loan officers. The program will be used to calculate the
interest rate and monthly payments of customers of who would like a loan to
buy a house. The program should take as input the the cost of the house
the customer would like to buy, the down payment on the house the customer
plans to make, and the customer's yearly salary. The program should then
compute the interest rate and monthly payment of both a 15 year and a 30 year
loan. The program should print only the loans that the customer qualifies for
and the total cost of the house if only minimum payments are made.
These can be computed using the following rules:
- The interest rate is 0.00375 if the down payment is 20% or greater.
- The interest rate is 0.005 if the down payment is less than 20% and greater
than or equal to 10%.
- If the down payment is less than 10%, the customer does not qualify for a
loan.
- If the monthly payments of a loan are more than half the customer's monthly
income, the customer does not qualify for the loan.
- The monthly payments for a loan are i*(a*(i+1)p/((i+1)p-1)), where i is the interest rate, p is the number of monthly payments, and
a is the loan amount (house cost minus the down-payment).
The program's output should look similar to the following.
CS Bank International Mortgage Calculator
=========================================
Enter house cost: $100000
Enter down payment: $10000
Enter yearly income: $18000
------------------------
You qualify for a 30 year mortgage with monthly payments of $539.59.
If you make only minimum payments, the total cost of the house will be $204254.37.
If the customer qualifies for both a 15 and 30 year mortgage, it should print
information about both. If the customer does not qualify for a mortgage, it
should print out why (either the down payment is not enough, or yearly income
is not enough). The dollar amounts
should be printed using the NumberFormat
class.
Other Requirements
- You must use meaningful names for variables, constants, and
your class. Use Java conventions for case -- constants (declared
with final) are all uppercase (with the underscore separating words),
variables start with a lowercase letter (but each separate word
within the variable starts with a capital), the class name is
capitalized.
Choosing meaningful names makes your program easier to read and follow.
- Use white space (blank lines and blank spaces) in your program to make
it easier to read. Separate the sections of the program with blank lines.
Indent and align your code properly.
- Document your program. At the top you must have documentation that
includes the file name, a brief description of
what the program does, the date, and your name.
Use in-line documentation to document each major section of code. However,
don't document every line!!
- See the following
code conventions for more detail about formatting
and documenting your program.
- Warning: A program that doesn't compile receives almost no credit
no matter how small the error.
Submission
To submit your code, create a zip file named YourLastName.zip and
upload the zip file to the course Inquire site.