1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227

#include <iostream>
#include <cmath>
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." <<endl ;
cout << endl ;
cout << "Enter R, the annual interest rate here ==> R = " ;
cout << endl ;
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 = " ;
cout << endl ;
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=R/5200) ;
}
/* **************************************** */
/* 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 "<<N<<" weekly payements of\n" ;
cout << "$"<<P<<" at "<<R<<" is "<<fv<<" \n" ;
cout << endl ;
}
/* **************************************** */
/* END */
/* **************************************** */
 