CIS170C Programming Please Enter The Car Loan Amount DeVry University
- Description
- Full Document
DeVry University
CIS170C Programming Please Enter The Car Loan Amount DeVry University
WEEK 2
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
//Variables
double lengthOfLoan, amountOfLoan, interestRate, monthlyPayment, loanTotal,
totalInterest;
//Program
cout << “Welcome to the car loan Calculator!\n”
<< “You will be asked to enter the amount of your loan,\n”
<< “the interest rate, and lenth you would like your car loan for.\n”
<< “The program will then tell you your monthly car payment.\n\n”;
cout << “Please enter the car loan amount: $”;
cin >> amountOfLoan;
cout << “Please enter the interest rate: “;
cin >> interestRate;
cout << “Please enter the length of the car loan in months: “;
cin >> lengthOfLoan;
//Calculations
totalInterest = amountOfLoan * interestRate;
loanTotal = (amountOfLoan + totalInterest);
monthlyPayment = loanTotal / lengthOfLoan;
//Display monthly payment
cout << fixed << setprecision(2);
cout << “Your monthly car payment is: $” << monthlyPayment << “\n”;
system(“pause”);
return 0;
Preview

