|
Author | Topic: been wroking on a loan (Read 365 times) |
[Mb] Administrator
     i got hit by the w0obug... member is offline
Coder.
Joined: Apr 2006 Gender: Male  Posts: 186 Location: Perth, Western Australia Karma: 8 |  | been wroking on a loan « Thread Started on Aug 2, 2006, 3:52pm » | |
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
| |
|
John Full Member
   member is offline
Joined: Jun 2006 Gender: Male  Posts: 152 Karma: 0 |  | Re: been wroking on a loan « Reply #1 on Aug 2, 2006, 10:44pm » | |
i could make one of those in JS in a couple hours ...
Very cool though i could'nt make one in C++ tho..
|
![[image]](http://img314.imageshack.us/img314/9071/sig8wk.png) |
|
Charismatic Enigma Administrator
     member is offline
![[avatar]](http://r2.mrfrufru.com/Haydentomas/random.jpg)
Joined: Apr 2006 Gender: Male  Posts: 952 Location: Watford, UK Karma: 2 |  | Re: been wroking on a loan « Reply #2 on Aug 3, 2006, 9:57am » | |
Hope its finished soon 
|
My 1st Post - 29/03/06 10:14 My 100th post - 23/05/06 18:38 My 500th Post - 07/06/06 19:35
|
|
|