Details of this Paper

To calculate how long it will take to pay off a loan

Description

solution


Question

To calculate how long it will take to pay off a loan.;Assignment;Your program will ask the user to enter the amount of money they want to borrow, the interest rate, and the monthly payment amount. Your program will then determine how many months it will take to pay off that loan, what the final payment amount will be, and how much interest was paid over that time. If the monthly payment amount isn't high enough to pay off more than one month's interest, your program should notify the user what the minimum monthly payment is.;Requirements;? Use the exact same test cases as these.;? The user enters the interest rate as an annual percentage rate. You need to convert this annual percentage to a monthly decimal. For example, 12% annual interest is 1% per month, which is 0.01;? Your program must allow only positive numbers to be entered by the user, as shown above.;? This program should mimic the standard way loans work for credit cards, car loans, and home mortgages: Each month the following happens;o The balance (amount owed) is multiplied times the monthly interest rate to determine how much interest is owed this month.;o This amount of interest is added to the principal (additional debt);o This amount of interest is also added to the total interest so far (to be output at end);o The monthly payment is subtracted from the balance, reducing the amount of debt.;o The month is counted (to be output at end);o This is repeated each month until the debt is paid off (balance reaches zero).;? Your program must notify the user if their monthly payment isn't high enough, and tell them what the minimum payment is to pay off one month's interest (and thus make progress paying off the debt).;? Your program must use at least 2 functions in addition to main. At least one of these functions must use a call-by-reference parameter. These functions can be of your choosing, but here are two ideas for functions you could write for your program;void getInput(double& principal, double& interestRate, double&& payment);/* This function asks the user to input the principal, interestRate;and monthly payment amount, and only accepts positive numbers for input.;All three parameters are call-by-reference, so the function;in effect returns the three values by changing the values of;the arguments which are passed to it. The initial values of;these parameters are ignored and overwritten.;*/;void payOffLoan(double principal, double interestRate, double monthlyPayment, int& months, double& totalInterest, finalPayment);/*;Pre-Conditions;? there needs to be a declared variable to pass to the function that has the value of the starting principle;? there needs to be a declared variable to pass to the function that has the value of the interest rate;? there needs to be a declared variable to pass to the function that has the value of the amount of the monthly payment;? there needs to be a declared variable to receive the value of the total number of months it talks to pay off loan;? there needs to be a declared variable to receive the value of the total amount of interest paid during that time;? there needs to be a declared variable to receive the value of the final payment;Post-Conditions;? This function checks to be sure that the monthly payment is enough to cover the first month's interest. If not, an appropriate message is given and the program exits.;? The variable passed to the function for months receives a value = number of months it took to pay off loan;? The variable passed to the function for totalInterest receives a value = total amount of interest paid during that time;? The variable passed to the function for finalPayment receives a value = the amount of the final payment;It may help to think of principal, interestRate, and monthlyPayment as input parameters, and months, totalInterest and final Payment as output parameters.;*/;Your grade will be based upon your program's professional appearance. So take care with things like indentation, comments, variable names, etc.

 

Paper#68256 | Written in 18-Jul-2015

Price : $32
SiteLock