Problem Statement: You are required to write a program that lets the user enter the loan amount and loan period in number of years and displays the monthly and total payments for each interest rate starting from 3.50% to 8.00%, with an increment of 0.25. If you enter the loan amount 5,000 for five years, it will display a table as follows:
What is the main purpose of developing this program? Elaborate your steps to solve the problem and determine the input, process and output for the program. Finally write a pseudo-code and draw a flowchart to solve this problem.
1
Expert's answer
2012-06-15T08:46:55-0400
#include <iostream.h> #include <conio.h> #include <math.h> main(){ float L,ap,mp,tp,C;& //L - loan amount, ap - annual payment, mp - monthly payment, tp - total payment, c - interest rate int Y,N,i; //Y - loan period in years, N - loan period in months, i - counter cout<<"Enter the loan amount: "; cin>>L; cout<<"Enter the loan period: "; cin>>Y; cout<<"InterestRate"<<"& quot;<<"MonthlyPayment"<<"& quot;<<"TotalPayment\r\n"; C = 3.5; for (i=0;i<=18;i++){ & //the month payment is one-twelfth of an annual payment: & mp = ( L + ( ( L * C/100 ) * Y ) ) / ( Y * 12 ); & //Let's calculate the total payment: & tp = mp*12*Y; & //printing results: & cout<<C<<"%& quot;<<mp<<"& quot;<<tp<<"\r\n"; & //calculating next interest value: & C = C+0.25; & } getch(); }
Comments
Leave a comment