Skip to main content
0 online
theremin thereminOG 2002

So I have to figure out a way to convert my Java mortgage calculator to C++.

Any suggestions?

Doesn't have to be GUI though.

theremin thereminOG 2002

Nevermind on my request for help on this one. I started to get it rolling finally.

I'll post what I did next week maybe.

I'm doing a little spin on my original Java version.

theremin thereminOG 2002

ended up making a monthly remaining balance mortgage program. would be nnice if it worked tho. I was on a roll until I tried to add the feature of showing the remaining balance each month until the entire loan was paid off.

anyway, here's what I did... corrections appreciated

#include
#include
#include

//Program figures out a mortgage repayment schedule
//Showing the user how much of the balance on the loan remains after each month

using namespace std;

int main(int argc, char *argv[])
{

char exit;

double amount;
int term;
double rate;
double result;

double principal;
double monthly_interest;

double towards_bal;
double new_bal;

double new_interest_amount;

int count;

//To escape the program Hit x
cout << "To exit Hit x";
cin >> exit;
cout << endl;

//Program runs unless x is hit
while (exit != 'x');
{
//User enters Amount without commas
cout << "Enter full amount of your home mortgage loan: $";
cin >> amount;

cout << "Enter the interest rate in percentage: %";
cin >> rate;

cout << "How much can you pay per month in dollars: $";
cin >> principal;

monthly_interest = (rate / 12) * amount * 0.01;
cout << "Your monthly interest is: $" << monthly_interest << endl;

towards_bal = principal - monthly_interest;
cout << "Contribution towards balance of principle would be: $" << towards_bal;

cout << endl;
cout << endl;

new_bal = amount - towards_bal;

//After the first month is figured out, a do while loop is entered in order
//to display the remaining balances for each month until the entire loan
//is pay off, in other words until the balance equals zero
do
{

outData.open("a:\\prog.out"); //open output file
outData << endl;
outData << "Balance: $" << new_bal << endl;

cout << endl;

cout << "Your new balance as of the following month would be: $";
cout << new_bal;

cout << endl;

new_interest_amount = monthly_interest = (rate / 12) * new_bal * 0.01;
cout << "Based on this payment next month's interest amount would be: $";
cout << new_interest_amount;

cout << endl;

towards_bal = principal - new_interest_amount;
cout << "Contribution towards balance of principle would be: $" << towards_bal;

new_bal = new_bal - towards_bal;
}
while (new_bal != 0);

cout << endl;
}

outData.close();

}
system("PAUSE");
return EXIT_SUCCESS;
}

Welcome Back to eZabel

It's been a while. Here's what's new.

eZabel Lore

A complete history of our community — stats, Hall of Fame, legendary threads, and more.

View the Lore →

Everything Preserved

All 225,969 pieces of content from 2000–2014 are here — forums, messages, journals, photos, polls, and events.

💎

Gems

Spot something you love — a legendary comment, a classic thread, a great photo? Log in and click the diamond icon to mark it as a Gem. Add a note about why it's special. The best stuff surfaces on the Gems page.