Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <iomanip>
- #include <cstdlib>
- using namespace std;
- int tp=0; // total months/payments/periods
- double p=0; // principal
- float ar=0; // APR
- double PI=0; // total interest
- double sub=0; //subtotal
- double m=0; //monthly payment
- double ep=0;//end payment
- double tt=0; // principal + interest
- double tpay () {//Total Payments function
- PI = ((p*ar)/12);
- sub = (p+PI);
- while (int tp=1, double p <= double m, double sub--m) {
- }
- ar = ar/100;
- //tp = p * (1+mr); //Total Payments
- tt = p * ((1+ar));
- sub = (p+PI);
- ep = sub-m;
- return 0;
- }
- //void final () //Final Payment
- //{
- // while (p > 0)
- //}
- int main()
- {
- //double p=0; //principal
- //double r=0; // rate
- //double compound;
- //double m=0; //monthly payment
- double final=0; //final payment
- cout << "** Welcome to the Consumer Loan Calculator **"<< endl;
- cout << "How much would you like to borrow? $" <<setw(5);
- cin >>p;
- cout << "What is your annual percentage rate? %"<<setw(5);
- cin >>ar;
- cout << "What is your monthly payment? $"<<setw(5);
- cin >> m;
- cout << "The total amount of interest you will pay during that time is $" << tt <<endl;
- if (final < m)
- {
- cout << "Your debt will be paid off aftert"<< tpay() << "tmonths, with a final payment of just $" << final <<endl;
- }
- //do {
- // p += (p * (ar/100));
- //}
- //while (
- cout <<"Don't get overwhelmed with debt!"<<endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement