Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4. #include <cstdlib>
  5. using namespace std;
  6.  
  7. int tp=0; // total months/payments/periods
  8. double p=0; // principal
  9. float ar=0; // APR
  10. double PI=0; // total interest
  11. double sub=0; //subtotal
  12. double m=0; //monthly payment
  13. double ep=0;//end payment
  14. double tt=0; // principal + interest
  15.  
  16.  
  17. double tpay () {//Total Payments function
  18.  
  19. PI = ((p*ar)/12);
  20. sub = (p+PI);
  21.  
  22. while (int tp=1, double p <= double m, double sub--m) {
  23.  
  24. }
  25.  
  26.  
  27.  
  28. ar = ar/100;
  29. //tp = p * (1+mr); //Total Payments
  30. tt = p * ((1+ar));
  31.  
  32. sub = (p+PI);
  33. ep = sub-m;
  34.  
  35.  
  36. return 0;
  37.  
  38. }
  39.  
  40. //void final () //Final Payment
  41. //{
  42. // while (p > 0)
  43. //}
  44.  
  45. int main()
  46. {
  47. //double p=0; //principal
  48. //double r=0; // rate
  49. //double compound;
  50. //double m=0; //monthly payment
  51. double final=0; //final payment
  52.  
  53. cout << "** Welcome to the Consumer Loan Calculator **"<< endl;
  54. cout << "How much would you like to borrow? $" <<setw(5);
  55. cin >>p;
  56. cout << "What is your annual percentage rate? %"<<setw(5);
  57. cin >>ar;
  58. cout << "What is your monthly payment? $"<<setw(5);
  59. cin >> m;
  60.  
  61. cout << "The total amount of interest you will pay during that time is $" << tt <<endl;
  62.  
  63. if (final < m)
  64. {
  65. cout << "Your debt will be paid off aftert"<< tpay() << "tmonths, with a final payment of just $" << final <<endl;
  66. }
  67.  
  68. //do {
  69. // p += (p * (ar/100));
  70. //}
  71. //while (
  72.  
  73. cout <<"Don't get overwhelmed with debt!"<<endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement