Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions