Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.142.250.86
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/drsparks/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/drsparks/project11.cpp
//--------------------------------------------------------------------------------------------------------------
// First Project for Computer Science Class
//
// Written by Dale Sparks
// September 2008
//
// Purpose:  To Calculate monthly payment for a loan, to calculate
//           balance at the halfway point of paying back your loan,
//           and the total interest paid.
//--------------------------------------------------------------------------------------------------------------


//-----Preprocessing Section-----

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

// -----Main Function-----

int main ()
 {

// -----Variables and Broken-Up Equations-----

  float
     i,                                         // annual interest rate
     pa,
     pb,
     pc,
     pd,
     pe,
     paymt,
     ba, 
     bb, 
     bc,
     bd,
     be, 
     bal,
     loan,
     ia,
     n,
     ti;

//-----Input Phase-----

 cout << "Welcome to the Loan Analysis Program!!!" << endl;
 cout << "Enter Loan Amount ----------------------> ";
 cin >> loan;
 cout << "Enter Annual Interest Rate (decimal)----> ";
 cin >> i;
 cout << "Enter Number of Monthly Payments--------> ";
 cin >> n;

//-----Processing Phase-----

 pa = i / 12;
 pb = 1 + pa;
 pc = pow(pb,n);
 pd = pc - 1;
 pe = pc / pd;
 paymt = pe * loan *  pa;
 ba = n / 2;
 bb = ba - n;
 bc = pow(pb,bb);
 bd = 1 - bc;
 be = bd / pa;
 bal = paymt * be;
 ti = i * paymt * n;
 ia = i * 100;

//-----Output Phase-----


   cout << fixed << setprecision(2);
   cout << "\n\n-----=====Loan Summary=====-----";
   cout << "\n\nAnnual Interest Rate:             " << ia << "%";
   cout << "\nNumber of Monthly Payments:       " << n;
   cout << "\n\nLoan Amount:                    $ " << loan;
   cout << "\nMonthly Payment:                $ " << paymt;
   cout << "\nBalance Halfway Through:        $ " << bal;
   cout << "\nTotal Interest Paid:            $ " << ti << endl;

 return 0;
}

Stv3n404 - 2023