Write a C++ program that asks the user to enter the price of a car (real), the down payment (real) and the number of years for the loan (integer). Calculate and output the monthly payment (real) of that car. Assume the sales tax rate for the first year is 7% and an interest rate is 9% and from second year the interest rate increased to 12%. Use constant declarations for these rates.
Use the following formulae to perform the calculations: tax amount = price of car * sales tax rate total cost of car = price of car + tax amount borrowed amount = total cost of car - down payment interest amount = borrowed amount * interest rate loan amount = borrowed amount + interest amount monthly payment = loan amount / number of months of loan Note:
•
int main() { double price, payment; int year; cout << "Input a price of the car: "; cin >> price; cout << "Input a down payment: "; cin >> payment; cout << "Input number of years: "; cin >> year;
Comments
Leave a comment