All pastes #747304 Raw Edit

Mine

public text v1 · immutable
·published 2007-10-23 21:58 UTC
rendered paste body
#include <iostream>
using namespace std;

int main(){

	//Declaring variables given in the project
	float fltLoan1 = 55000;
	float fltLoan2 = 26000;
	float fltInterest1 = .009;
	float fltInterest2 = .006;
	float fltPayment = 0;

	int intMonthCounter = 0;

	//Deal with Paying off Loan1
	while (fltLoan1 > 0)
	{
		intMonthCounter++;
		cout << "Month #" << intMonthCounter << endl;
		fltPayment = 1500 - ((fltLoan1 * fltInterest1) + (fltLoan2 * fltInterest2));
		cout << "Your month's payment breaks down like this:\n" << "Interest Payment on Loan 1 ($55,000 @ .9%) is: " << (fltLoan1 * fltInterest1) << endl;
		cout << "Interest Payment on Loan 2 ($26,000 @ .6%) is: " << (fltLoan2 * fltInterest2) << endl;

		if (fltLoan1 - fltPayment > 0)
		{
			fltLoan1 -= fltPayment;
			cout << "Payment to Loan 1's premium is: " << fltPayment << endl;
			cout << "Loan 1 has " << fltLoan1 << " left as its balance." <<endl;
			cout << "Loan 2 has " << fltLoan2 << " left as its balance." <<endl;
			cout << "------------" << endl;
		}
		else
		{
				fltPayment -= fltLoan1;
				fltLoan2 -= fltPayment;
				cout << "Payment to Loan 1's premium is: " << fltLoan1 << endl;
				cout << "Loan 1 has been payed off." << endl;
				cout << "Loan 2 has " << fltLoan2 << " left as its balance." <<endl;
				cout << "------------" << endl;
				fltLoan1 = 0;
		}
	}

	//Now Pay off Loan2
	while (fltLoan2 > 0)
	{
		intMonthCounter++;
		cout << "Month #" << intMonthCounter << endl;
		fltPayment = 1500 - (fltLoan2 * fltInterest2);
		cout << "Your month's payment breaks down like this:\nInterest Payment on Loan 2 ($26,000 @ .6%) is: " << (fltLoan2 * fltInterest2) << endl;
	
		if (fltLoan2 - fltPayment > 0)
		{
			fltLoan2 -= fltPayment;
			cout << "Payment to Loan 2's premium is: " << fltPayment << endl;
			cout << "Loan 2 has " << fltLoan2 << " left as its balance." <<endl;
			cout << "------------" << endl;
		}
		else
		{
			cout << "Payment to Loan 2's premium is: " << fltLoan2 << endl;
			cout << "Loan 2 has been payed off." <<endl;
			cout << "------------" << endl;
			fltPayment -= fltLoan2;
			cout << "You have " << fltPayment << " left over to keep." << endl;
			fltLoan2 = 0;
		}
	}

	cout << "Both Loans have been payed off." << endl;

	return 0;
}