Guest User

Untitled

a guest
Nov 18th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.64 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     cout.setf(ios::fixed);
  8.     cout.setf(ios::showpoint);
  9.     cout.precision(2); //Set to control the number of extra characters in double variables.
  10.  
  11.     int month;
  12.     int payment;
  13.     double principal; //upphæð láns
  14.     double monthy_intrests = 0.015; //afborganir á mánuði
  15.     double remaning_intrests; //vestir alls
  16.     double intrests_paid; //lokaupphæð láns
  17.     double remaning_dept;//samtals vextir borgaðir
  18.  
  19.  
  20.     //Principal : 1000$
  21.     //Intrests : 18% per year (1.5% per month)
  22.     //Monthly payments : 50$
  23.  
  24.     cout <<"Insert the cost of the item in $ (no more then 2500$) : ";
  25.     cin >> principal;
  26.     cout <<"-------------------------------------------" << endl;
  27.     month = 0;
  28.     payment = 50;
  29.     remaning_dept = principal;
  30.     remaning_intrests = principal - payment;
  31.  
  32.  
  33.         do
  34.         {
  35.             intrests_paid = remaning_intrests * monthy_intrests; //Intrest paid = 15$
  36.  
  37.             remaning_intrests = payment - intrests_paid; //remaning after intrest payment = 50 - 15 = 35$
  38.  
  39.             remaning_dept = remaning_dept - remaning_intrests; //1000 - 35
  40.  
  41.             cout << "Month: " << month << ", Interest paid: " << intrests_paid << ", Remaining debt: " << remaning_dept << endl;
  42.  
  43.             month++;
  44.         }while(remaning_dept >=50);
  45.        
  46.         do
  47.         {
  48.            
  49.         }while(remaning_dept =<50);
  50.  
  51.         cout << "-------------------------------------------" << endl;
  52.         cout << "Number of months: " << month << endl;
  53.         cout << "Total intrest paid: " << intrests_paid << endl;
  54.  
  55.  
  56.  
  57.  
  58.     return 0;
  59. }
Add Comment
Please, Sign In to add comment