functions-hw-soln - / I'm providing the complete program as...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// I'm providing the complete program as the solution. To answer question #3, it is // appropriate to use pass by value for the (process) function to implement the // compound interest formula, as none of the parameters are to be changed by the // method. // Programmer: Doug Hogan // Section: N/A // Program: Solution to this homework problem: // http://php.scripts.psu.edu/djh300/cmpsc201/functions-hw.htm // Date: October 19, 2008 // Description: This program implements the compound interest formula, where // compounding is done annually. #include <iostream> #include <math.h> using namespace std; void GetInputs(double & principal, double & annualInterestRate, double & yearsInvested) // POST: principal contains an amount in dollars, annualInterestRate contains an annual // interest rate expressed as a decimal, yearsInvested contains how many years // principal is to be invested { cout << "How much money do you want to invest, in dollars? "; cin >> principal; cout << "What is the annual interest rate, as a percentage, e.g. 2.5? ";
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 02/10/2011.

Page1 / 2

functions-hw-soln - / I'm providing the complete program as...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online