Server IP : 172.16.15.8 / Your IP : 3.133.108.47 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/pswoodson/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
//---------- Preprocessor Section ----------- #include<isotream> #include<iomainip> #include<cmath> using namespace std //---------- Main Function ----------- int main() { //----- Variables and Constants int loan amount, number of monthly payments, i = loan amount; float annual interest rate, monthly payment, balance halfway through, total interest paid, n = monthly payment; //---- Input Phase cout << "\n\n Welcome to loan analysis program"; cout << "enter the loan amount ---> "; cin >> loan amount; cout << "enter the number of monthly payments -> "; cin >> number of monthly payments; cout << "enter the interest rate ---> "; cin >> interest rate; //----- Processing Phase temp = pow((1+1/12),n) temp1 = pow((1+1/12),k-n) payment = (temp/temp-1 ) * loan * (i/12) balance = payment * (1-(temp1))/(i/12) //----- Output Phase cout << Fixed; // force fixed point format for floats cout << "\n\n~~~~~~~~~~~~~~~~ Loan Summary ~~~~~~~~~~~~~~ "; cout << "setprecision(2); cout << "\n\n Annual Interest Rate: " << interest rate; cout << "\n Number Of Monthly Payment: "<< number of monthly payments; cout << "setprecision(2); cout << "\n Loan Amount: "<< loan amount; cout << "setprecision(2); cout << "\n Monthly payment: "<< monthly payment; cout << "setpercision(2); cout << "\n Balance halfway through: "<< balance halfway through; cout << "setpercision(2); cout << "\n Total interest paid: "<< interest paid; return 0; }