Calculate the interest
Assume you are trying to calculate the cost of buying a car.
The cost of the car is $14,800. You made a trade of your old car
to the dealer for $1,600 and put down a down payment of $3,000.
You will pay off the balance over the next four years by means
of a loan which charges 10% simple interest.
Your assignment is to calculate the total amount of money (balance
plus interest) you will need over the next four years to pay off
the loan and the monthly payment. Use the following formula to
calculate the interest:
I = Prt
Where "I" is the simple interest, "P" is
the principle, "r" is the interest rate and "t"
is the time in years.
To calculate the monthly payment, use the following formula:
P = T / (t * 12)
Where "P" is the monthly payment, "T" is
the loan total including interest and "t" is the loan
duration in years.
The homework is to implement the algorithm as described above.
The program should output the amount of interest on the loan,
the total amount of the loan and the monthly payment.
The loan principle is: principle
The total interest is: total interest
The loan total is: loan total
The monthly payment is: monthly payment
- Program listing
- Program output