Question: Write a program to calculate and display the loan for buying a car. 1 . Create a class call Loan. Data fields in the Loan

Write a program to calculate and display the loan for buying a car.
1. Create a class call Loan.
Data fields in the Loan class include:
1 Annual Interest Rate (Float)
2. Number of years of loan (int)
3. Loan Amount (Float)
4. Borrowers Name (string)
2. Create the initializer or constructor for the class with the above data fields. Make the data fields private.
3. Create accessors (getter) for all the data fields(there should be 4 getters).
4. Create mutators (setters) for all the data fields(there should be 4 setters.
5. Create a class method - getMonthlyPayment where
monthlyPayment = loanAmount * monthlyInterestRate /(1-(1/(1+ monthlyInterestRate)**(numberOfYears *12)))
note: that the monthlyInterestRate = annualInterestRate /1200(this line of code must be before the
monthlyPayment calculation formula)
6. Create a class method - getTotalPayment where
totalPayment = getMonthlyPayment()* numberOfYears *12
7. Write a test program (main function) to allow the user to enter the following:
1. Annual Interest Rate
2. Number of Years of Loan
3. Loan Amount
4. Borrowers Name
5. Allow the user to change the loan amount and reprint the new loan information.
**use same object instantiated to change the loan, not allowed to create a new object.
Note : you are not allowed to use the break or continue statement for this program set 1. Using a break
or continue statement will result in a zero score for this program set.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!