Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Youve been hired by Lizard Lenders to write a C++ console application that determines the number of months to repay a car loan. Use a

Youve been hired by Lizard Lenders to write a C++ console application that determines the number of months to repay a car loan. 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. Here is sample output:

image text in transcribed

Run the program with the following inputs:

Loan amount

Monthly payment

Annual interest rate

6,000

~

~

3,000

700

~

256.82

8

5

4,000

292.91

4

5,000

319.18

3

We l come to Lizard Lenders Enter the car loan amount (1K-5K): 2500 Enter the monthly payment (100-500): 400 Enter the annual interest rate (2-5%): 2 Balance($) 2104.17 1707.67 1310.52 912.70 514.23 115.08 284.73 Interest($) 4.17 3.51 2.85 2.18 1.52 0.86 0.19 Principal($) 395.83 396.49 397.15 397.82 398.48 399.14 399.81 Month Payment($) 400.00 400.00 400.00 400.00 400.00 400.00 400.00 4 6 Months to repay loan: 7 End of Lizard Lenders

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

Intelligent Information And Database Systems Second International Conference Acids Hue City Vietnam March 2010 Proceedings Part 1 Lnai 5990

Authors: Manh Thanh Le ,Jerzy Swiatek ,Ngoc Thanh Nguyen

2010th Edition

3642121446, 978-3642121449

Students also viewed these Databases questions

Question

1. Explain why strategic planning is important to all managers.

Answered: 1 week ago