Answered step by step
Verified Expert Solution
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.
Create a class call Loan.
Data fields in the Loan class include:
Annual Interest Rate Float
Number of years of loan int
Loan Amount Float
Borrowers Name string
Create the initializer or constructor for the class with the above data fields. Make the data fields private.
Create accessors getter for all the data fieldsthere should be getters
Create mutators setters for all the data fieldsthere should be setters.
Create a class method getMonthlyPayment where
monthlyPayment loanAmount monthlyInterestRate monthlyInterestRatenumberOfYears
note: that the monthlyInterestRate annualInterestRate this line of code must be before the
monthlyPayment calculation formula
Create a class method getTotalPayment where
totalPayment getMonthlyPayment numberOfYears
Write a test program main function to allow the user to enter the following:
Annual Interest Rate
Number of Years of Loan
Loan Amount
Borrowers Name
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 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started