Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 CALL-BY-VALUE FUNCTION Filename: A3ques11.cpp Suppose you want to deposit a certain amount of money called the principal (P) into a saving account and use

image text in transcribed
1 CALL-BY-VALUE FUNCTION Filename: A3ques11.cpp Suppose you want to deposit a certain amount of money called the principal (P) into a saving account and use the following formula to calculate the future value (F) after n years, where r is the annual interest rate. Write a program that calls a function named futureValue(int p, int n, double r) that performs this calculation. The function receives the principal (integer), number of years (integer) and annual interest rate (double) as arguments. It should return the future value (double). Next, in your main program, use a while loop with sentinel control to prompt the user to enter the principal, number of years, and annual interest rate, and then call the function future Value. Each answer should be formatted with 2 decimals and trailing zeros. You must verify that the rate is in the range 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions