473,385 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Loan Payoff Table Help

Greetings,
I am working on writing a C++ program and am relatively new in doing so. I am finding computer programming interesting and enjoy learning how to write the source code. If anyone could take the time to aid me in writing my program I would be greatly appreciative.
The purpose of this programming project is to write a C++ program to calculate a car loan payoff table to see how long it would take to pay off a car loan for a given value car. For example, if you borrow $10,000 at an annual interest rate of 12% (12%/12 per month) with a monthly payment of $150, in the first month you will pay $100 interest and still owe $9,950. How many months would it be before the loan is paid off?

Month Principle Interest Payment
1 10,000.00 100.00 150.00
2 9,950.00 99.50 150.00
3 9,899.50 99.00 150.00
4 9,848.50 98.49 150.00

I need to write a program to solve the problem. User input will include the amount of the loan, the interest rate (in percent), and the monthly payment amount, and the program prints out the length of the loan in years and months and the total amount paid in interest over the life of the loan.
Can anyone kindly take a few minutes and give me some help?
Oct 15 '06 #1
8 11660
Banfa
9,065 Expert Mod 8TB
You seem to have a firm grasp of the problem. Encode it yourself and then if you have a specific problem with your code post the code and the problem here and we will help.
Oct 16 '06 #2
My lab partner and I came up with this code that calculates the interest paid but are unsure how to modify it in order to be able to enter the monthly payment and displays the output in a table. Any ideas?



#include <iostream>
#include <math.h>

float LoanAmount, InterestRate, BalanceA, BalanceB, Payment, DecimalInterestRate, LoanPayment;
int NumberOfMonths, i, MonthlyInterest;
float MonthlyPayment,InterestPaid;
int main ()
{
cout<<"Please enter the loan amount: ";
cin>>LoanAmount;
cout<<"Please enter the interest rate: ";
cin>>InterestRate;
cout<<"Please enter the loan duration in months: ";
cin>>NumberOfMonths;

DecimalInterestRate=(InterestRate/100)/12;
//Formula used: a = [P((1 + r)^n)r]/[(1 + r)^n - 1]
BalanceA=LoanAmount*(pow((1+DecimalInterestRate),N umberOfMonths))*DecimalInterestRate;
BalanceB=(pow(1+DecimalInterestRate,NumberOfMonths ))-1;
MonthlyPayment=BalanceA/BalanceB;
cout<< "Monthly Payment on the loan is $"<< MonthlyPayment<< " for "<<NumberOfMonths<<" months."<<endl;
InterestPaid=(MonthlyPayment*NumberOfMonths)-LoanAmount;
cout<<"For a "<<NumberOfMonths<<" month amoritization, the interest paid is $"<<InterestPaid<<"."<<endl;

return 0;
}
Oct 16 '06 #3
Banfa
9,065 Expert Mod 8TB
My lab partner and I came up with this code that calculates the interest paid but are unsure how to modify it in order to be able to enter the monthly payment and displays the output in a table. Any ideas?
Well you are already inputing 3 values at the start of this code so that should be easy enough for you to copy.

As to the table that is fairly easy, have a calculation variable, set it to the loan amount. Then for each month you can calculate the interest for the month. output the data for that month using a cout statement then adjust the calculation variable by adding the interest and taking off the monthly payment.

At some point you will get the situation of calculation variable + interest - monthly payment < 0. At this point stop the loop, there is a final payment of calculation variable + interest.
Oct 16 '06 #4
i'm trying to get my output to look something like this...

Please enter the following information about your loan:
Amount of loan:____
Annual interest rate:____
Monthly payment:_____

Month Interest Principle Balance
1 etc etc etc


Loan totals:
The loan was paid off in ______ months
Total interest paid_____

Please help?
Oct 17 '06 #5
Banfa
9,065 Expert Mod 8TB
Just write some cout statements that output the lines as you want them.
Oct 17 '06 #6
thanks for helping me.
I'm still not quite understanding how to get the output.


#include <iostream>
#include <math.h>

int main()
{
float LoanAmount, InterestRate, DecimalInterestRate, Newprince, BalanceA,
BalanceB;
int NumberOfMonths;
float MonthlyPayment,InterestPaid;

cout << "Please Enter the Amount of Loan: ";
cin >> LoanAmount;

cout << "Please Enter the Interest Rate: ";
cin >> InterestRate;

cout << "Please Enter the Monthly Payment: ";
cin >> MonthlyPayment;

DecimalInterestRate=(InterestRate/100)/12;
InterestPaid=(MonthlyPayment*NumberOfMonths)-LoanAmount;
Newprince=(LoanAmount+DecimalInterestRate)-MonthlyPayment;
BalanceA=LoanAmount*(pow((1+DecimalInterestRate),N umberOfMonths))*DecimalInterestRate;
BalanceB=(pow(1+DecimalInterestRate,NumberOfMonths ))-1;

return 0;
}

any idea what i should add?
Oct 18 '06 #7
tyreld
144 100+
If you are trying to create a table of the number of payments like you have outlined in the problem description I would recommend using a loop. Fill in the psuedo code with with real code. I've probably provided you with a bit more then I should.

Expand|Select|Wrap|Line Numbers
  1. int month = 0;
  2.  
  3. cout << "MONTH \t PRINCIPLE \t INTEREST \t PAYMENT" << endl;
  4.  
  5. while (LOAN NOT PAID OFF) {
  6.    INCREMENT MONTH;
  7.  
  8.    interest = CALCULATE INTEREST;
  9.  
  10.    total_interest = CALCULATE TOTAL INTEREST SO FAR;
  11.  
  12.    cout << month << "\t" << principal << "\t" << interest << "\t" << payment << endl;
  13.  
  14.    principal = CALCULATE NEW PRINCIPLE;
  15. }
  16.  
  17. cout << endl;
  18. cout << "Loan Totals:" << endl;
  19. cout << "The loan was paid off in " << months << " months." << endl;
  20. cout << "The total interest paid was $" << total_interest << endl;
  21.  
Oct 18 '06 #8
hey you guys know how you can make that program(car loan) print out whether you are approved or not...i guess you would have to use an If statement...
Dec 6 '06 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: JMCN | last post by:
i am running into problems with is the recordset. i have exactly 104 records. when i tested the code, the end result was multiple records for the same loan(ET LN Shortname). where did i go wrong? ...
3
by: Serious_Practitioner | last post by:
Happy New Year! I am looking around for an MS-Access based database that will help me manage the collections of 20-30 small loans. I need to be able to create amortization schedules when the...
0
by: clarale | last post by:
Hello Everyone, Could someone helps me. I receive a file from a company sending all the hyperlink attached to an order. I would like to switch that hyperlink from an order to a loan then put it...
0
by: Pedro Moreno | last post by:
I created my first Loam amortization schedule in VB.net but now I need to add the rule of 78 to be use in cars loans. I need help with it. Does any body have a sample template or sample code...
2
by: phjones | last post by:
Need help programming mortagage calculator for 3 different loans 7 year, 15 year and 30 year. using java array I am a beginner with Java, This is what I have so far. Need to know if I am off the...
1
by: phjones | last post by:
please help resolve some error messages code is compling with errors see below the code. I am new at this please help! /** * @(#)3 Mortgage loans.java * * 3 Mortgage loans application * ...
2
by: fatimahtaher | last post by:
Hi, I am new to C# programming and my first assignment requires me to calculate total interest paid on a loan. The user will input the loan, the interest rate per month, and the monthly payment....
1
by: paradox6996 | last post by:
Ok I've tried to google this but no luck their. I'm writing a program that calculates someones consumer loan. If we use $1000 as principle, and 15%(.15) as the rate and the duration of the loan is 18...
2
by: SATHYA JEEVA KANTH | last post by:
i and my friend were given a assignment which ask us to do c++ programme for loan adviser. my lecturer actually didnt taught us properly for this subject bcoz she went for leave bout 2 month. this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.