functions-hw - n payment periods Assignment: You don't need...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Functions Homework Assignment Look at the example program from today's class notes where we used a function to read in inputs to the compound interest formula. Recall the compound interest formula: A n = P (1+ i ) n where: P is the principal, or amount of money initially invested i is the interest rate per payment period as a fraction (0 <= i <= 1; 5% interest would be treated as 0.05 here) n is the number of payment periods A n is the amount the inverstment is worth after interest has accrued on the given principal at the given interest rate after
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: n payment periods Assignment: You don't need to write a complete program. You may handwrite or type. 1. Now write a function that computes how much an investment is worth based on the three inputs to the formula and returns the value of the investment. 2. Then write the function call you'd add to the main program to call this function. Where would this call go? 3. Did you use passing by reference or passing by value for each of the parameters you used in #1? Explain your choices....
View Full Document

Ask a homework question - tutors are online