1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Help with a C++ Program

Discussion in 'C++' started by golf_girl32, Sep 28, 2010.

  1. golf_girl32

    golf_girl32 New 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 a moderator: Sep 29, 2010
  2. golf_girl32

    golf_girl32 New 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 a moderator: Sep 29, 2010
  3. jimblumberg

    jimblumberg New Member

    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 likes this.

Share This Page