//Question #42085, Programming, C++
#include <iostream>
using namespace std;
int main () {
const float salesTaxRate = 7;
const float interestRate = 9;
float price;
float downPayment;
int numberOfYears;
float monthlyPayment = 0;
cout << "Please enter the price of the car :\n";
cin >> price;
cout << "Please enter down payment :\n";
cin >> downPayment;
cout << "Please enter the number of years for the loan :\n";
cin >> numberOfYears;
price += price*(salesTaxRate / 100); //add to the price the tax for the sale
price -= downPayment;// price without downPayment
price += price*(interestRate/100); // add to the price interest Rate
monthlyPayment = price / (numberOfYears*12);
cout << "You will pay " << monthlyPayment << " in a month.\n";
return 0;
}
Comments
Leave a comment