Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- string sirname;
- string lastname;
- double num_of_payments;
- double num_of_years;
- double loan_amount;
- double monthly_rate;
- double annual_rate;
- double monthly_payment;
- double amount_paid;
- double interest_amount;
- cout << "What is your name? (format: Mr. Smith): ";
- cin >> sirname >> lastname;
- cout << sirname << lastname << ", what is the amount of your loan? (format: 2450) ";
- cin >> loan_amount;
- cout << "What is the annual interest rate of your loan? (format: 3.0) ";
- cin >> annual_rate;
- cout << "How many years do you have to pay this loan? (format: 5) ";
- cin >> num_of_years;
- cout << "The loan amount is " << loan_amount << endl;
- annual_rate = annual_rate / 12;
- cout << "The annual rate is" << annual_rate << endl;
- num_of_payments = num_of_years * 12;
- cout << "The number of payments is " << num_of_payments << endl;
- monthly_payment = loan_amount * ((annual_rate * pow(1.0 + annual_rate, num_of_payments)) / ((pow(1.0 + annual_rate, num_of_payments) - 1));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement