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 07:30
Jasper and samantha are in a robotics competition. the guidelines state that the robots should be able to move a 10-gram weight at least 2 meters and turn in a circle. jasper and samantha have already built the robot. which step of the design process should they follow next to decide whether their robot meets the minimum criteria for the competition?
Answers: 1
question
Computers and Technology, 24.06.2019 00:30
Which boolean operator enables you to exclude a search term? a} not b} and c} or d} plus
Answers: 1
question
Computers and Technology, 24.06.2019 06:30
Me and category do i put them in because this is science
Answers: 1
question
Computers and Technology, 24.06.2019 17:50
Which of the following best describe how the depth-limited search works. a normal depth-first search is performed but the number of ply/depths is limited. a normal breadth-first search is performed but the number of ply/depths is limited. a normal breadth-first search is performed but values above a specific value will be ignored. a normal depth-first search is performed but values above a specific value will be ignored.
Answers: 1
You know the right answer?
Enhance your program from Exercise 20 by first telling the user

the minimum monthly pay...
Questions
question
Mathematics, 03.12.2021 20:20
question
English, 03.12.2021 20:20
question
Spanish, 03.12.2021 20:20
question
Social Studies, 03.12.2021 20:20
Questions on the website: 13722367