subject

Enhance your program from Exercise 20 by first telling the user

the minimum monthly payment and then prompting the user to enter the monthly payment.
Your last payment might be more than the remaining loan amount and interest on it. In this case, output the actual amount of the last payment. Also, output the total interest paid.

#include

#include

using namespace std;

int main ()

{

double loanAmount;

double interestRate;

double interestRatePerMonth;

double monthlyPayment;

double paymentPrincipal;

int months;

cout << fixed << showpoint;

cout << setprecision(2);

cout << "Enter the loan amount: ";

cin >> loanAmount;

cout << endl;

cout << "Enter the interest rate per year: ";

cin >> interestRate;

cout << endl;

interestRatePerMonth = (interestRate / 100) / 12;

cout << "Enter the monthly payment: ";

cin >> monthlyPayment;

if (monthlyPayment <= loanAmount * interestRatePerMonth)

{

cout << "Monthly payment is too low. The loan cannot be repaid."

<< endl;

return 1;

}

months = 0;

while (loanAmount > 0)

{

paymentPrincipal = monthlyPayment - (loanAmount * interestRatePerMonth);

loanAmount = loanAmount - paymentPrincipal;

months++;

}

cout << "It will take " << months << " months to repay the loan."

<< endl;

return 0;

}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:40
How do i get the most points, without any effort?
Answers: 2
question
Computers and Technology, 22.06.2019 15:20
This os integrated the processing power of windows nt with the easy-to-use gui of windows 98. windows 2000 windows 3.11 windows for workgroups windowa millennium edition
Answers: 1
question
Computers and Technology, 23.06.2019 20:00
What software programs are used to to create professional publication? a.) graphics programs b.) word processors c.) page layout programs d.) spreadsheet programs
Answers: 2
question
Computers and Technology, 23.06.2019 22:30
You draw two cards from a standard deck of 52 cards, but before you draw the second card, you put the first one back and reshuffle the deck. (a) are the outcomes on the two cards independent? why?
Answers: 3
You know the right answer?
Enhance your program from Exercise 20 by first telling the user

the minimum monthly pay...
Questions
question
Physics, 23.05.2020 21:02
Questions on the website: 13722360