Question

When you borrow money to buy a house, a car, or for some other purpose, you...

  1. When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now, the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2 / 12 = 0.6%. The first month’s interest on $1,000 is 1000 * 0.006 = 6. Because the payment is $25 and the interest for the first month is $6, the payment toward the principal amount is 25 - 6 = 19. This means after making the first payment, the loan amount is 1,000 - 19 = 981. For the second payment, the interest is calculated on $981. So, the interest for the second month is :

981 *0.006 = 5.886, that is, approximately $5.89. This implies that the payment toward the principal is 25 - 5.89 = 19.11 and the remaining balance after the second payment is 981 - 19.11 = 961.89.

This process is repeated until the loan is paid. Write a program that accepts as input the loan amount, the interest rate per year, and the monthly payment. (Enter the interest rate as a percentage. For example, if the interest rate is 7.2% per year, then enter 7.2.) The program then out- puts the number of months it would take to repay the loan. (Note that if the monthly payment is less than the first month’s interest, then after each payment, the loan amount will increase. In this case, the program must warn the borrower that the monthly payment is too low, and with this monthly payment, the loan amount could not be repaid.)

  1. Enhance your part 1 program 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 loan amount before the last payment and the actual amount of the last payment. Also, output the total interest paid.

C++

0 0
Add a comment Improve this question Transcribed image text
Answer #1

A.

#include<iostream>
using namespace std;
main()
{
float loan;
int months = 0;
float rate, monthpay, mrate;
cout<<"Enter the loan amount: ";
cin>>loan;
cout<<"Enter the monthly pay: ";
cin>>monthpay;
cout<<"Enter the rate of interest per annum: ";
do {
cin>>rate;
mrate = rate / 12;
if(monthpay < loan * (mrate / 100))
{
cout<<"The monthly payment is too low, and with this monthly payment, the loan amount could not be repaid. Please re-enter new monthly pay:\n";
}
}while(monthpay < loan * (mrate / 100));
while(loan > 0)
{
months++;
loan = loan - (monthpay - loan * (mrate / 100));
}
cout<<"No. of months required to repay the loan is "<<months<<" months";

}

B.

#include<iostream>
using namespace std;
main()
{
float loan;
int months = 0;
float rate, monthpay, mrate, totinterest = 0.0;
cout<<"Enter the loan amount: ";
cin>>loan;
cout<<"Enter the rate of interest per annum: ";
cin>>rate;
mrate = rate / 12;
cout<<"Minimum monthly pay must be: "<<loan * (mrate / 100)<<endl;
cout<<"Enter the monthly pay: ";
cin>>monthpay;

while(loan > 0)
{
months++;
totinterest += loan * (mrate / 100);
if(loan - (monthpay - loan * (mrate / 100)) < 0)
{
cout<<"Loan amount before last payment is: "<<loan<<endl;
cout<<"Actual payment on last month: "<<loan + (loan * (mrate / 100))<<endl;
}
loan = loan - (monthpay - loan * (mrate / 100));
}
cout<<"No. of months required to repay the loan is "<<months<<" months"<<endl;
cout<<"Total interest paid: "<<totinterest<<endl;

}

Add a comment
Answer #2

Code has been posted here:

#include<iostream>

using namespace std;

int main(){

   float principal, i_rate_annum, monthly_interest, monthly_interest_temp, monthly_pay, effective_monthly_pay;
   float temp, total_interest;
   int number_of_months = 0;

   cout<<"Enter Loan Details: \n";
   cout<<"Enter Principal Amount: ";
   cin>>principal;
   cout<<"Enter interest rate per annum in %: ";
   cin>>i_rate_annum;
   cout<<"Enter monthly repay: ";
   cin>>monthly_pay;
  
   monthly_interest_temp = ((i_rate_annum/12)*principal)/100;
  
   if(monthly_interest_temp > monthly_pay){
       cout<<"Monthly payment "<<monthly_pay<<"$ is too low, the loan amount could not be repaid\n";
      
       //Part B suggesting borrower to enter monthly payment more than the monthly interest rate
       cout<<"You better pay monthly payment more than Monthly interest rate " <<monthly_interest_temp<<"$\n";
  
       cout<<"Re-Enter monthly repay: ";
       cin>>monthly_pay;
      
   }
  
   temp = principal;
  
   while(1){
  
       //Calculating monthly intest and monthly pay towards loan amount
       monthly_interest = ((i_rate_annum/12)*principal)/100;      
       effective_monthly_pay = monthly_pay - monthly_interest;
       principal -= effective_monthly_pay;
      
       if(principal <= 0)
           break;
      
       //If last month payment is more than the remaining loan amount
       //Suggesting borrower to enter only the remaining money
       if(monthly_pay > principal){
           cout<<"Remaining principal amount "<<principal<< "$ is less than the monthly pay " <<monthly_pay<<"$\n";
           cout<<"Pay "<<monthly_interest+principal<<"$\n";
          
           cout<<"Re-Enter monthly repay equal to "<<monthly_interest+principal<<": ";
           cin>>monthly_pay;
       }
      
       number_of_months++;
       total_interest += monthly_interest;
  
   }  
  
   cout<<"Number of months the loan to be paid "<<number_of_months <<"\n";
   cout<<"Total Interest to be paid "<<total_interest <<"$\n";

   return 0;
}

Output screenshot:

Code Screenshot:

If you have any doubts regarding this answer do let me know.

Add a comment
Know the answer?
Add Answer to:
When you borrow money to buy a house, a car, or for some other purpose, you...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • When you borrow money to buy a house or a car, you pay off the loan...

    When you borrow money to buy a house or a car, you pay off the loan in monthly payments, but the interest is always accruing on the outstanding balance. This makes the determination of your monthly payme on a loan more complicated than you might expect. If you borrow P dollars at a monthly interest rate ofras decimal) and wish to pay off the note in months, then your monthly payment M = M(Prt) in dollars can be calculated using...

  • Amortization Table In order to buy a house, Robert is going to borrow $220,000 today with...

    Amortization Table In order to buy a house, Robert is going to borrow $220,000 today with an 8.50% nominal annual rate of interest. He is going to make monthly payments over 15 years. Assuming full amortization of the loan, what percentage of his second monthly payment will go toward the repayment of principal?(round each calculation to the nearest dollar.) a. 28.25% b. 29.65% c. 26.55% d. 27.90% e. 30.15%

  • You borrow money (take out a mortgage) to buy a house. You borrow $800,000 which you...

    You borrow money (take out a mortgage) to buy a house. You borrow $800,000 which you will pay back with 10 equal payments made at the end of each of the next 10 years. The annual interest rate is 7 percent. Your first payment will be ____ principal payment, and _____ interest paid.

  • You borrow $40,000 to buy a car. The loan is to be paid off in 10...

    You borrow $40,000 to buy a car. The loan is to be paid off in 10 equal monthly payments at 12% interest annually. The first payment is due one month from today. What is the amount of each monthly payment? (Round to nearest ones)

  • You borrow $150,000 to purchase a house. You will make annual payments over the next 10 years to repay the loan. Assumin...

    You borrow $150,000 to purchase a house. You will make annual payments over the next 10 years to repay the loan. Assuming that your interest rate is 12%, what is amount of principal remaining at the beginning of year 2(after the first payment)? $132,000 $141,452 $145,500 $138,740 Please use financial calculator :) Thank you!

  • In order to buy a car, you borrow $35,000 from a friend at 12%/year compounded monthly...

    In order to buy a car, you borrow $35,000 from a friend at 12%/year compounded monthly for 4 years. You plan to repay the loan with 48 equal monthly payments. a. How much are the monthly payments? b. How much interest in in the 23rd payment? c. What is the remaining balance after the 37th payment?

  • Ben Thenking wants to borrow $300,000 to buy a house. He plans to live there for...

    Ben Thenking wants to borrow $300,000 to buy a house. He plans to live there for exactly 5 years before selling the house, repaying the lender the balance and moving. Ben is considering a 30 year fully amortizing fixed rate mortgage with monthly payments. The banker shows Ben three loan options: (1) A loan with a 5% annual interest rate which requires Ben to pay 2 points up front, (2) the same terms as (1), but the loan principal is...

  • 1) You wish to borrow $150,000 from a lending institution for the purchase of a house....

    1) You wish to borrow $150,000 from a lending institution for the purchase of a house. The bank will lend this amount at an Annual Percentage Rate of 4.5% to be paid-off with equal monthly mortgage payments over a 30-year period. This is a 4.5% APR, 30-year fixed-rate mortgage loan. You wish to know how this loan will affect your federal income tax burden, as only the interest paid on a home mortgage, not the principal, is tax deductible. Construct...

  • 12. You decide to buy a car that costs $15.000. You want to borrow all the...

    12. You decide to buy a car that costs $15.000. You want to borrow all the money at a 6.5% (annual) interest rate. You want to pay it in 4 months. Find your monthly payment and write it in the table below. a. Fill in the amortization schedule showing how much of each of your monthly payments go to interest and how much to your principal. Principal: $15,000.00 Interest Rate: 6.50% Payment Interval: Monthly # of Payments: 4 Payment: S...

  • 8. Prepare the loan amortization schedule ($15) You borrow $1,000, and the loan is to be...

    8. Prepare the loan amortization schedule ($15) You borrow $1,000, and the loan is to be repaid in three equal payments at the end of each of the next three years. The lender charges a 6 percent interest rate on the loan balance that is outstanding at the beginning of each year. 1) Calculate the payment the firm must repay each year. 2) Prepare the loan amortization schedule (fill all the numbers in each cell). Beginning Amount Repayment of Remaining...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT