Help with a C++ Program

golf_girl32's Avatar
Go4Expert Member
I'm supposed to be writing a program for a mortgage calculator. I seem to be stuck and am quite frustrated. If someone could offer some advice that would be amazing. We are supposed to be sticking strictly to call-by-value and call-by-reference.

here is what I was so far

Code:
#include <iostream>

void get_input(int& principle, double& annual_rate, int& length_years);
//The program receives three inputs from operator

void conversions (double& annual_rate, double& monthly_rate_decimal, int& length_years, int& length_months);
//Converts annual interest rate to the monthly interest rate

double monthly_payment (int& principle, double& monthly_rate_decimal, int& length_months, double monthly_payment);
//Computes and prints the monthly payment

void monthly_amounts;
//Computes the remaining values in the amortization table

void print_payment_table;
//Prints values of monthly interest, principal payment and new principle balance

void print_header;
//Prints the header of the amortization table

int main()

{
    int (first_num, second_num, third_num);

    get_input (first_num, second_num, third_num);
    conversions (first_num, second_num);
    monthly_payment (first_num);
    monthly_amounts (first_num, second_num, third_num);
    print_payment_table;
    print_header;
}

{

int prin;
    cout<<"Please enter the principal: ";
    cin>>prin;

double rate;
    cout<<"Please enter the annual interest rate: ";
    cin>>rate;
    1>=rate<=10;

int years;
    cout<<"Please enter the length of the loan (in YEARS): ";
    cin>>years;
}

Last edited by shabbir; 29Sep2010 at 08:31.. Reason: Code blocks
golf_girl32's Avatar
Go4Expert Member
I have progressed a bit more but now the program isn't letting me type anything. Any ideas of what is causing this?
Code:
#include <iostream>

void get_input(int& principle, double& annual_rate, int& length_years);
//The program receives three inputs from operator

void conversions (double& annual_rate, double& monthly_rate_decimal, int& length_years, int& length_months);
//Converts annual interest rate to the monthly interest rate

double monthly_payment (int principle, double monthly_rate_decimal, int length_months, double monthly_payment);
//Computes and prints the monthly payment

void monthly_amounts (int principle, double monthly_rate_decimal, double m_interest_payment, double m_principle_payment);
//Computes the remaining values in the amortization table

void print_payment_table (double m_interest_payment, double m_principle_payment, double new_principle);
//Prints values of monthly interest, principal payment and new principle balance

void print_header (char print_header);
//Prints the header of the amortization table

int main()
{
 int principle, length_years, length_months;
 double annual_rate, monthly_rate_decimal;
 char print_header;
}

void get_input(int& principle, double& annual_rate, int& length_years)
{

using namespace std;

cout<<"Please enter the principal: /n";
cin>>principle;

cout<<"Please enter the annual interest rate: ";
cin>>annual_rate;

cout<<"Please enter the length of the loan (in YEARS): ";
cin>>length_years;

}

Last edited by shabbir; 29Sep2010 at 08:31.. Reason: Code blocks
jimblumberg's Avatar
Ambitious contributor
In your main function:
Code:
int main()
{
	int principle, length_years, length_months;
	double annual_rate, monthly_rate_decimal;
	char print_header;
}
Where are you calling any of your functions?

Please use code tags.


Jim
shabbir like this