Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The consumer loan department of a bank asks a software analyst to write a Java program that can calculate the monthly payment of a mortgage

The consumer loan department of a bank asks a software analyst to write a Java program that can calculate

the monthly payment of a mortgage

the principal paid in each monthly payment

the interest paid in each monthly payment,

After reading (from the console) necessary data the loan amount, the loan period (in months), and the annual interest rate, the program processes the data and then prints out (to the console) the following pieces of information as follows:

The loan amount in the 1st line

The loan period (how many months) in the 2nd line

The annual interest rate in the 3rd line

(Leave the next line blank)

Next, the program prints out the following text as shown:

Payment #: Monthly Payment Principal Interest Balance

Andfinally the program prints out the following details of a monthly payment (one line for each payment)

Payment #

Monthly payment amount

Principal paid in the monthly payment

Interest paid in the monthly payment

Balance of the loan after the monthly payment

The inputs must be verified to be sure that they are not negative. All the floating-point numbers of the outputs have 2 digits after the floating point.

Sample of the outputs:

Loan amount: 10000.00

Number of months: 6

Annual interest rate: 2.00

Payment # Monthly Payment Principal Interest Balance

1 1676.40 1659.74 16.67 8340.26

2 1676.40 1662.50 13.90 6677.76

3 1676.40 1665.27 11.13 5012.49

4 1676.40 1668.05 8.35 3344.44

5 1676.40 1670.83 5.57 1673.61

6 1676.40 1673.61 2.79 0.00

Important Notes:

Formula to compute the monthly payment:

monthly payment = loanAmount*monthlyInterestRate/1/1-((1+monthlyInterestRate)^numberOfMonths

Other formulas:

Monthly interest rate = annual interest rate / 12

Interest (in monthly payment) = monthly interest rate * current balance

principal (in monthly payment) = monthly payment - interest

balance (after monthly payment has been paid) = current balance - principal

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions