### Why doesn't my program work?

The goal is to execute this but my program doesn't execute the results. "Here is your answer:

The future value of 50 weekly payments of
\$25.55 at 2.375% is \$1292.49."
 ``1234567891011121314151617181920212223242526272829303132`` ``````This program will calculate the future value of N weekly payments of P dollars at annual interest rate R. You will be prompted to enter P, R, and N (in that order) and then the future value will be calculated and written to the screen. You must now enter the amount of the payment P in decimal form (for example: 54.55). Do *not* include a dollar sign (\$). Do *not* include any commas. Enter P, the amount of each weekly payment here ==> P = 25.55 Now you must enter the annual interest rate in decimal form (for example: 8.125). Do *not* include a percent sign (%). Do *not* include any commas. Enter R, the annual interest rate here ==> R = 2.375 Now you must enter the number of weekly payments as a whole positive integer (for example: 45). Do *not* include a decimal point or any commas Enter N, the number of weekly payments, here ==> N = 50 Here is your answer: The future value of 50 weekly payments of \$25.55 at 2.375% is \$1292.49.``````

Here's my program.
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221`` ``````#include #include using namespace std ; /* PROTOTYPES */ void PrintDirections() ; /* Exactly what this function must do: Print directions for the user of the program. */ double GetPmt() ; /* Exactly what this function must do: Prompt the user to enter the amount of the weekly payment, read it in, and return it to the caller. */ double GetRate() ; /* Exactly what this function must do: Prompt the user to enter the amount of the annual interest rate, read it in, and return it to the caller. */ int GetNumWeeks() ; /* Exactly what this function must do: Prompt the user to enter the number of weekly payments, read it in, and return it to the caller. */ double Compute_FV(double P, double R, int N) ; /* Exactly what this function must do: Return the future value of N payments of P dollars at annual interest rate percentage R. */ void Report_FV(double P, double R, int N, double fv) ; /* Exactly what this function must do: Report to the user -- tell the user that fv is the future value of N payments of P dollars at annual interest rate percentage R. */ /* **************************************** */ /* MAIN */ /* **************************************** */ int main () { double pmt, rate ; int weeks; PrintDirections(); pmt = GetPmt() ; rate = GetRate() ; weeks = GetNumWeeks() ; } /* **************************************** */ /* PRINT DIRECTIONS */ /* **************************************** */ /* Exactly what this function must do: Print directions for the user of the program. */ void PrintDirections() { cout << endl ; cout << "This program will calculate the futrue calue of N\n" ; cout << "weekly payments of P dollars at annual interest\n" ; cout << "rate R." << endl ; cout << endl ; cout << "You will be prompted to enter P, R, and N (in that\n" ; cout << "order) and then the future value will be\n" ; cout << "calculated and written to the screen." << endl ; cout << endl ; } /* **************************************** */ /* GETPMT */ /* **************************************** */ /* Exactly what this function must do: Prompt the user to enter the amount of the weekly payment, read it in, and return it to the caller. */ double GetPmt() { cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(2); double pmt ; cout << endl ; cout << "You must now enter the amount of the payment P in\n" ; cout << "decimal form (for example: 54.55). Do *not*\n" ; cout << "include a dollar sign (\$). Do *not* include any\n" ; cout << "commas." << endl ; cout << endl ; cout << "Enter P, the amount of each weekly payment here ==> P = " ; cin >> pmt ; return pmt ; } /* **************************************** */ /* GETRATE */ /* **************************************** */ /* Exactly what this function must do: Prompt the user to enter the amount of the annual interest rate, read it in, and return it to the caller. */ double GetRate() { cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(3); double rate ; cout << endl ; cout << "Now you must enter the annual interest rate in\n" ; cout << "decimal form (for example: 8.125). Do *not*\n" ; cout << "include a percent sign (%). Do *not* include any\n" ; cout << "commas." < R = " ; cin >> rate ; return rate ; } /* **************************************** */ /* GETNUMWEEKS */ /* **************************************** */ /* Exactly what this function must do: Prompt the user to enter the number of weekly payments, read it in, and return it to the caller. */ int GetNumWeeks() { int weeks ; cout << endl ; cout << "Now you must enter the number of weekly payments\n" ; cout << "as a whole positive integer (for example: 45). Do *not*\n" ; cout << "include a decimal point or any commas.\n" ; cout << endl ; cout << "Enter N, the number of weekly payments, here ==> N = " ; cin >> weeks ; return weeks ; } /* **************************************** */ /* COMPUTE_FV */ /* **************************************** */ /* Exactly what this function must do: Return the future value of N payments of P dollars at annual interest rate percentage R. */ double Compute_FV(double P, double R, int N) { double r = R/5200 ; double FV = P * (pow(r + 1, N) - 1) * (r + 1) / r ; return FV ; } /* **************************************** */ /* REPORT_FV */ /* **************************************** */ /* Exactly what this function must do: Report to the user -- tell the user that fv is the future value of N payments of P dollars at annual interest rate percentage R. */ void Report_FV(double P, double R, int N, double fv) { cout << endl ; cout << "Here is your answer\n" ; cout << endl ; cout << "The future value of "<
Your Compute_FV and Report_FV functions aren't being called anywhere.
Topic archived. No new replies allowed.