Guest User

Untitled

a guest
Oct 17th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.30 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);
  10.     double loan;
  11.     double interest_rate;
  12.     double intr2=0;
  13.     int payment = 0;
  14.     int count = 0;
  15.     cout << "===========================================\n";
  16.     cout << "Input the cost of the item in $ (the debt): ";
  17.     cin >> loan;
  18.     if (loan >=2501)
  19.     {
  20.         cout << "Invalid input" << endl;
  21.         cout << "Please type another input less or equal to 2500$: ";
  22.         cin >> loan;
  23.     }
  24.     if (loan <=1000)
  25.         do
  26.     {
  27.        count ++;
  28.         interest_rate=loan*0.015;
  29.         loan=loan-50+interest_rate;
  30.         cout << "Month " << count << "  -  ";
  31.         cout << " Interest paid: " << interest_rate << "  -  ";
  32.         cout << " Remaining debt: " << loan << endl;
  33.  
  34.   }
  35.     while (loan>0);
  36.     if (loan <0)
  37.     {
  38.         loan=0;
  39.     }
  40.     {
  41.     if (loan <= 2500 && loan >=1001);
  42.   {
  43.         do
  44.     {
  45.         count++;
  46.         intr2=loan*0.02;
  47.         loan=loan-50+intr2;
  48.         cout << "Month " << count << "  -  "
  49.         << "Interest paid: " << intr2 << "  -  "
  50.         << " Remaining debt: " << loan << endl;
  51.     }
  52.     while (loan>0);
  53.     if (loan <0)
  54.     {
  55.         loan=0;
  56.     }
  57.  
  58. }
  59. }
  60.  
  61.     return 0;
  62. }
Add Comment
Please, Sign In to add comment