Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

It is supposed to tell me the number of months the money will last, cannot have

ID: 3641042 • Letter: I

Question

It is supposed to tell me the number of months the money will last, cannot have negative numbers and needs to have two decimal points. Please help.

#include <iostream>
#include <cmath>

using namespace std ;

void PrintDirections() ;
double GetPrinc() ;
double GetPmt() ;
double GetRate() ;
int Compute_Months(double S, double P, double R) ;
void Report_Months(double S, double P, double R, int N) ;

/* **************************************** */
/* MAIN */
/* **************************************** */

int main ()
{
double S ;
double P ;
double R ;
int N ;
PrintDirections() ;
S = GetPrinc() ;
P = GetPmt() ;
R = GetRate() ;
int Compute_Months() ;
void Report_Months() ;
return 0 ;
}
/* **************************************** */
/* PRINT DIRECTIONS */
/* **************************************** */

/* Print directions for the user of the program. */

void PrintDirections()
{
double R ;
double S ;
double P ;
int N ;
cout << "This program will determine how many times one can " ;
cout << "withdraw P dollars from an account earning interest rate " ;
cout << "R, assuming the initial value of the account is S dollars. " ;

cout << "You will be prompeted to enter S, P, and R, (in that " ;
cout << "order). and then the number of monthly paymets possible " ;
cout << "will be calculated and written to the screen. " ;

cout << "You must now enter the amount of the initial principal " ;
cout << "sum, S, in the account, in decimal form (for example: " ;
cout << "257823.21). Do *not* include any commas). " ;
cout << "Enter S, the amount of the initial principal sum here ==> S = " ;
cin >> S ;
cout << endl ;

cout << "You must now enter the amount of the monthly payment P in " ;
cout << "decimal form (for example: 1554.55). Do *not* " ;
cout << "include a dollar sign ($). Do *not* include any " ;
cout << "commas. " ;

cout << "Enter P, the amount of the monthly payment here ==> P = " ;
cin >> P ;
cout << endl ;

cout << "Now you must enter the annual interest rate in " ;
cout << "decimal form (for example: 4.125). Do *not* " ;
cout << "include a percent sign (%). Do *not* include any " ;
cout << "commas. " ;

cout << "Enter R, the annual interest rate here ==> R = " ;
cin >> R ;
cout << endl ;

if (
}

/* **************************************** */
/* GETPRINCIPAL */
/* **************************************** */

/* Prompt the user to enter the amount of principle
read it in, and return it to the caller. */

double GetPrinc()
{
double S ;
S = GetPrinc() ;
}

/* **************************************** */
/* GETPMT */
/* **************************************** */

/* Prompt the user to enter the amount of the monthly payment,
read it in, and return it to the caller. */

double GetPmt()
{
double P ;
P = GetPmt() ;
}

/* **************************************** */
/* GETRATE */
/* **************************************** */

/* Prompt the user to enter the amount of the annual interest
rate, read it in, and return it to the caller. */

double GetRate()
{
double R ;
R = GetRate() ;
}

/* **************************************** */
/* COMPUTE_MONTHS */
/* **************************************** */

/* Return the number of months until an initial S dollars runs
out if the account earns interest at an annual rate of R,
compounded monthly, and a payment of P dollars per month is
withdrawn. Precondition: S*R/1200 < P. */

int Compute_Months(double S, double P, double R)
{
int N ;
double r ;
r = R/1200 ;
N = (log(P) - log(P - (r * S)))/(log(1 + r)) ;
}

/* **************************************** */
/* REPORT_MONTHS */
/* **************************************** */

/* Report to the user -- tell the user that N is the number of
months it will take for S dollars to completely run out, if
annual interest rate R, compounded monthly, is earned, and P
dollars are withdrawn per month. */

void Report_Months(double S, double P, double R, int N)
{
cout << "Here is your answer: " ;
cout << "$" << S << endl ;
cout << "will run out after approximately " ;
cout << N << endl ;
cout << "months, assuming that an annual interest of " ;
cout << R << "%" << endl ;
cout << "is earned, compounded monthly, and a monthly payment of " ;
cout << "$" << P << endl ;
cout << "is withdrawn immediately after each interest payment. " ;

}


/* **************************************** */
/* END */
/* **************************************** */

Explanation / Answer

hi i ran this program and found out the error . In print decisions you have left an if statement without any condition or closing parenthesis . it is like if ( } Rectifying that gives the output . To be exact the error is in 77 th line before the comment /* **************************************** */ /* GETPRINCIPAL */ /* **************************************** */ hope it helps you

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote