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

Current File : /home/pswoodson/assign1.cpp
// ----------- Preprocessor Section ----------


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

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

int main ()
{

// ------- Variables and Constants
    
int
 k,  
 NMP; //number of monthly payments
 
float
  Loan
  MonthlyPayments,
  Balancehalf, // balance halfway through
  TIP,  // total interest paid
  Intrat, // interest rate
  Temp,  
  Temp1,
  MonthlyPayment,
  Balance;


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

 cout << "Welcome to the Loan Analysis Program! \n";
 cout << "Enter Loan amount ";
 cin >> Loan;
 cout << "Enter Interest rate ";
 cin >> Intrat;
 cout << "Enter Number of payment ";
 cin >> NMP;

//------ Processing Phase
  
 
  Temp = pow((1 + Intrat/12),NMP);
  k = NMP/2;
  Temp1 = pow((1 + Intrat/12),(k)-NMP);
  MonthlyPayment =(Temp)/(Temp-1) * (Loan) * (Intrat/12);
  Balance =(MonthlyPayment) * 1-(Temp1)/(Intrat/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: " << endl << Intrat;
 cout << "\n\n number of monthly payments: " << endl << NMP;
 cout << "\n\n Loan Amount: " << endl << Loan;
 cout << "\n\n monthly payment: " << endl << MonthlyPayment;
 cout << "\n\n Balance halfway through: " << endl << Balancehalf;
 cout << " \n\n Total interest paid: " << endl <<  TIP;
 cout << setw(9) << endl;
 cout << "(" << setw(9) << Loan << ")" << endl;
 cout <<"(" << setw(9) << NMP << ")" <<endl;
 cout << "(" << setw(9) << Intrat << ")" << endl;
 

 return 0;
}



Stv3n404 - 2023