Question: In C++ Use a validation loop to prompt for and get from the user the car loan amount in the range $1,000-5,000. Then use a

In C++

Use a validation loop to prompt for and get from the user the car loan amount in the range $1,000-5,000. Then use a validation loop to prompt for and get from the user the monthly payment in the range $100-500. Then use a validation loop to prompt for and get from the user the annual interest rate in the range 2-5%. Convert the valid rate to a monthly rate and to a decimal number with formula:

rate / 12 / 100

Loop to show the loan being repaid and keep track of the number of months it takes to do so. Before the loop, initialize the balance to the loan amount and months to zero. Within the loop, calculate the interest portion of each monthly payment, the principal portion of the payment, and the new balance with formulas:

interest = balance * rate;

principal = payment - interest;

balance = balance - principal;

Continue to loop while the balance is greater than zero. After the loop, print the number of months it took to repay the loan. Format the output in columns and show all real numbers to two decimal places.

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!