Use Java Programming Language Please Provide a Code that works Properly Loan Account Class:  Create class LoanAccount. Use a static variable annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable principal indicating the amount the person is borrowing. Provide method: public double calculateMonthlyPayment(int numberOfPayments) to calculate the monthly payment by using the following formula: double monthlyPayment = principal * ( monthlyInterest / (1 - Math.pow(1 + monthlyInterest, -numberOfPayments))); where monthly interest = annualInterestRate/12. Provide a static method setAnnualInterestRate that sets the annualInterestRate to a new value.  Set the initial loan amount (Principal) for a new loan through the constructor. Write a program to test class LoanAccount. Instantiate two LoanAccount objects, loan1 and loan2, with principal loan amounts of $5000.00 and $31000.00, respectively. Set annualInterestRate to 1%, then calculate the monthly payment for each loan for 36 months, 60 months, and 72 months and print the monthly payment amounts for both loans. Next, set the annualInterestRate to 5%, and output the same information again.  Make sure your dollar amounts are displayed to two decimal places.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Use Java Programming Language

Please Provide a Code that works Properly

Loan Account Class: 

Create class LoanAccount. Use a static variable annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable principal indicating the amount the person is borrowing. Provide method: public double calculateMonthlyPayment(int numberOfPayments) to calculate the monthly payment by using the following formula:

double monthlyPayment = principal * ( monthlyInterest / (1 - Math.pow(1 + monthlyInterest, -numberOfPayments)));

where

monthly interest = annualInterestRate/12.

Provide a static method setAnnualInterestRate that sets the annualInterestRate to a new value.  Set the initial loan amount (Principal) for a new loan through the constructor.

Write a program to test class LoanAccount. Instantiate two LoanAccount objects, loan1 and loan2, with principal loan amounts of $5000.00 and $31000.00, respectively. Set annualInterestRate to 1%, then calculate the monthly payment for each loan for 36 months, 60 months, and 72 months and print the monthly payment amounts for both loans. Next, set the annualInterestRate to 5%, and output the same information again.  Make sure your dollar amounts are displayed to two decimal places.

 Put the code to test the class in the main method of the LoanAccount Class. The output of your program should look like the following:

Monthly payments for loanl of $5000.00 and loan2 $31000.00 for 3, 5, and 6 year loans at 1 interest.
Loan
3 years 5 years 6 years
Loanl 141.04 85.47
71.58
Loan2 874.45 529.91 443.78
I
Monthly payments for loanl of $5000.00 and loan2 $31000.00 for 3, 5, and 6 year loans at 5% interest.
3 years 5 years 6 years
Loan
Loanl 149.85 94.36
80.52
Loan2 929.10 585.01 499.25
Transcribed Image Text:Monthly payments for loanl of $5000.00 and loan2 $31000.00 for 3, 5, and 6 year loans at 1 interest. Loan 3 years 5 years 6 years Loanl 141.04 85.47 71.58 Loan2 874.45 529.91 443.78 I Monthly payments for loanl of $5000.00 and loan2 $31000.00 for 3, 5, and 6 year loans at 5% interest. 3 years 5 years 6 years Loan Loanl 149.85 94.36 80.52 Loan2 929.10 585.01 499.25
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education