View Single Post
Old 06-09-2005, 02:48 PM   #1 (permalink)
simplex85
Registered User
 
Join Date: Jun 2005
Posts: 1
simplex85 is on a distinguished road
GAH!! how do i do total interest with while loops???? help me please =(

This is the code i have so far and i am dying on trying to find out how i can come up with the total interest paid with no user input.

I believe i have to come up with a second while loop after the section i marked in green. which i found out to be 24 months. But after that, i'm not sure how many statements i need and when i do do it i come up with some rediculous small number like -$0.03.

Code:
**************************************
#include <iostream>
using namespace std;
int main()

{
	double totalInterestPay;
	double debt = 1000.00;
	int count = 0;

		cout<< "This program will calculate the amount\n"
		<< "of months it will take for you to pay off your debt\n"
		<< "with a debt of $1000 and an annual\n"
		<< "interest rate of 18% at 1.5% per month.\n";

	while (debt > 0.00)
	
	{
		debt = debt * 0.015 + debt - 50;
		count++;

	}
	
		cout.setf(ios::fixed);
		cout.setf(ios::showpoint);
		cout.precision(2);


	cout<< endl << "Your debt will be paid off after " 
		<< count << " months.\n";
	cout<< endl<< "your total interst paid throughout\n"
		<< "the course of the loan is $"<< totalInterestPay 
		<< endl;

	

	return 0;

}

Last edited by redhead; 06-09-2005 at 11:23 PM. Reason: Added [code][/code] tags
simplex85 is offline   Reply With Quote