Program to tell you how many months it will take to pay off

Assignment Help C/C++ Programming
Reference no: EM13162275

 write a program to tell you how many months it will take to pay off any loan, as well as the total amount of interest paid over the life of the loan.

 

For example you have just purchased a stereo system that costs $1000 on the following credit plan: No down payment, an interest rate of 18% per year (and hence 1.5% per month), and monthly payments of $50. The monthly payment of $50 is used to pay the interest and whatever is left is used to pay part of the remaining debt. Hence, the first month you pay 1.5% of $1000 in interest. That is $15 in interest. So, the remaining $35 is deducted from your debt which leaves you with a debt of $965.00. The next month you pay interest of 1.5% of $965.00, which is $14.48. Hence, you can deduct $35.52 (which is $50 - $14.48) from the amount you owe.

 

Write a program that will tell you how many months it will take you to pay off any loan, as well as the total amount of interest paid over the life of the loan. Use a loop to calculate the amount of interest and the size of the debt after each month. Put out the monthly amount of interest paid and remaining debt. Use a variable to count the number of loop iterations and hence the number of months until the debt is zero. You may want to use other variables as well:

 

heres what i have done, How do i fix it?

 

//declaring the variables

double totalLoan,

balanceRemaining,

principal,

month,

annualPercentage,

monthlyPayment,

monthlyInterest,

interestPaid,

principalPaid;

 

cout <<setprecision(2)<<fixed;

cout <<"What is the amount of the loan?";

cin >> totalLoan;

while (totalLoan < 0)

{

cout <<"Invalid entry. Please enter a positive value only";

cin >> totalLoan;

}

cout <<"What is the annual percentage rate?";

cin >> annualPercentage;

while (annualPercentage < 0)

{

cout <<"Invalid entry. Please enter a positive value only";

cin >> annualPercentage;

}

cout << "Enter your monthly payment: "<<endl;

cin >> monthlyPayment;

cout <<endl;

cout <<endl;

cout <<"Month"<<setw(15)<<"Principal"<<setw(13)<<"Interest"<<setw(13)<<"Principal"<<setw(13)<<"Remaining";

cout <<setw(50)<<"paid"<<setw(12)<<"paid"<<setw(17)<<"Balance\n";

monthlyInterest = (annualPercentage/(12*100));

 

for (month = totalLoan; month >=0; ++month)

{

interestPaid= monthlyInterest*totalLoan;

principalPaid= monthlyPayment-interestPaid;

balanceRemaining=totalLoan-principalPaid;

principal=balanceRemaining+principalPaid;

cout <<month<<setw(15)<<principal<<setw(13)<<interestPaid<<setw(13)<<principalPaid<<setw(13)<<balanceRemaining;

 

}

 

 

getch();

 

}

 

 

Reference no: EM13162275

Questions Cloud

How does the hammond postulate explain : the fact that the relative reactivity of C-H bonds of an alkane for free-radical chain halogenation is tertiary > secondary > primary?
What volume would the gas occupy at the same temperature : A 31 L tank contains a gas under a pressure of 617 atm. What volume would the gas occupy at the same temperature at 900 torr of pressure? Answer in units of L.
How many grams of acetic acid are in vinegar : If 3.50ml of vinegar needs 42.0ml of 0.130M NaOH to reach the equivalence point in a titration, how many grams of acetic acid are in a 1.20qt sample of this vinegar?
The most stable form of bromine under standard conditions : The most stable form of bromine under standard conditions is as the diatomic molecule
Program to tell you how many months it will take to pay off : write a program to tell you how many months it will take to pay off any loan, as well as the total amount of interest paid over the life of the loan.
Compute the molar mass of maltose : Calculate the molar mass of maltose (which is not an ionic compound). (b) The density of the solution is 1.014 g/mL. Calculate the osmotic pressure of the solution.
Explain what is the total vapor pressure over the solution : A solution is made by adding 50.0 mL of ethanol (C2H5OH, d = 0.789 g/mL) to 50.0 mL of water (d = 0.998g/mL). What is the total vapor pressure over the solution
Write a function named largest which will receive the array : Write a function named largest which will receive the array as input and return the variable LargestNumber.
Nitrogen dioxide react with water to produce nitric acid : Nitrogen dioxide and water react to produce nitric acid HNO3 and nitrogen monoxide.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd