Post by [Mb] on Aug 2, 2006 15:52:03 GMT
iv been working on a loan calculator i have made this because i want to sse what tha banks really charge for browing money
//Include the Iostream and CMath file
#include <iostream>
#include <cmath>
//start main function
int main() {
//declare variables to be used
unsigned long loanAmount = 20000;
float annualInterestRate = 7.0;
unsigned short loanLength = 10;
const unsigned short MONTHS_IN_YEAR = 12;
bool approved = false; // approved for a loan
// preform the calculations
float monthlyInterestRate = annualInterestRate / MONTHS_IN_YEAR;
monthlyInterestRate = monthlyInterestRate/100;
unsigned short numberPayments = loanLength * MONTHS_IN_YEAR;
//Start calculation monthly payments
float monthlyPayment = 1 - pow((1 + monthlyInterestRate),
-numberPayments);
monthlyPayment = monthlyInterestRate/monthlyPayment;
monthlyPayment = loanAmount * monthlyPayment;
//print information
std::cout << "Assuming a loan in the amount of $" << loanAmount
<< ", at " << annualInterestRate << "% interest over "
<< loanLength << " years the monthly payment would be $";
//formatt numbers
std::cout.setf(std::ios_base::fixed);
std::cout.setf(std::ios_base::
showpoint);
std::cout.precision(2);
std::cout << monthlyPayment << " \n\n ";
//show if they are approved
std::cout << "According to our infomation you are";
std::cout << " (approved) ?";
std::cout << " already approved for this loan\n";
// make new line
std::cout << "\n";
//let user no what to do next
std::cout << "PRESS ENETR OR RETUEN TO CLOSE THE APP ";
std::cin.get();
return 0;
}
its still is not finshed but im getting there that is just the main shell so far
//Include the Iostream and CMath file
#include <iostream>
#include <cmath>
//start main function
int main() {
//declare variables to be used
unsigned long loanAmount = 20000;
float annualInterestRate = 7.0;
unsigned short loanLength = 10;
const unsigned short MONTHS_IN_YEAR = 12;
bool approved = false; // approved for a loan
// preform the calculations
float monthlyInterestRate = annualInterestRate / MONTHS_IN_YEAR;
monthlyInterestRate = monthlyInterestRate/100;
unsigned short numberPayments = loanLength * MONTHS_IN_YEAR;
//Start calculation monthly payments
float monthlyPayment = 1 - pow((1 + monthlyInterestRate),
-numberPayments);
monthlyPayment = monthlyInterestRate/monthlyPayment;
monthlyPayment = loanAmount * monthlyPayment;
//print information
std::cout << "Assuming a loan in the amount of $" << loanAmount
<< ", at " << annualInterestRate << "% interest over "
<< loanLength << " years the monthly payment would be $";
//formatt numbers
std::cout.setf(std::ios_base::fixed);
std::cout.setf(std::ios_base::
showpoint);
std::cout.precision(2);
std::cout << monthlyPayment << " \n\n ";
//show if they are approved
std::cout << "According to our infomation you are";
std::cout << " (approved) ?";
std::cout << " already approved for this loan\n";
// make new line
std::cout << "\n";
//let user no what to do next
std::cout << "PRESS ENETR OR RETUEN TO CLOSE THE APP ";
std::cin.get();
return 0;
}
its still is not finshed but im getting there that is just the main shell so far