F01.justanswer.com



#include <iostream>#include <iomanip>#include <math.h>using namespace std;int main(){cout << "Welcome Personal Loan Calculator" << endl;cout << endl;//Variablesdouble loanAmount, interestRate, lengthOfLoan, monthlyPayment; int choice = 0;//Description of Personal Calculator Programcout << "Personal Loan Calculator Program \n" << endl;cout << "What would you like to Calculate? \n" << endl;cout << "1.) Monthly Payment" << endl;cout << "2.) Loan amount" << endl;cout << "3.) Length of Loan \n" << endl;cout << "Please choose from 1 to 3: ";do{cin >> choice;if (choice < 2 || choice > 3){cout << "Invalid choice entered" << endl;cout << "Please choose from 1 to 3: ";}} while (choice < 2 || choice > 3);//Loan Amountif (choice == 2){//User Inputscout << "Please enter Loan Amount: $";cin >> loanAmount;cout << "Please enter Interest Rate (In %): ";cin >> interestRate;cout << "Please enter Length of Loan (In Years): ";cin >> lengthOfLoan;cout << endl;//CalculationinterestRate = interestRate / 100;monthlyPayment = (loanAmount * (interestRate / 12) * pow(1 + (interestRate / 12), (12 * lengthOfLoan))) / (pow((1 + interestRate / 12), (lengthOfLoan * 12)) - 1);//Outputcout << "Monthly Payment will be: $" << fixed << setprecision(2) << monthlyPayment; system("pause");return 0;}} ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download