#include #include using namespace std; int main () { cout << "Welcome to New York Loan Services. \n"; cout << "Please enter how much you would like to take out. \n"; double amount {0.00}; cin >> amount; if (!cin) { cout << "Sorry, That is not a number. Please try again."; return EXIT_FAILURE; } if (amount <= 0) { cout << "Sorry, the amount entered has to be above 0"; return EXIT_FAILURE; } cout << "How much time do you believe it will take to pay back the loan. \n"; cout << "Please enter the number of years (minium starting at 1 year): \n"; int nyears {0}; cin >> nyears; if (!cin) { cout << "Sorry, That is not a number. Please try again."; return EXIT_FAILURE; } if (nyears < 1) { cout << "As stated the minimum amount of years starts at 1. \n"; cout << "Please try again. \n"; return EXIT_FAILURE; } cout << "Special Promotion\n"; cout << "For new clients,"; cout << " we allow the placement of accured rate percentage for the 1st year. \n"; cout << "Please choose your annual interest rate. \n"; double rate {0.00}; cin >> rate; if (!cin) { cerr << "Sorry, that wasn't a number.\n"; return EXIT_FAILURE; } if (rate <= 0) { cerr << "Sorry, the interest rate must be positive.\n"; return EXIT_FAILURE; } double factor {1.00 + .01 * rate}; cout << "year amount\n" //column headings << "---- ------\n"; for (int year {1}; year <= nyears; ++year) { amount *= factor; cout << " " << setw(2) << year << " $" << fixed << setprecision(2) << amount << "\n"; } return EXIT_SUCCESS; }