Question: Program Description: Write a C program to compute the yield on an investment based on a simple interest calculation applied annually for certain number of

Program Description:

Write a C program to compute the yield on an investment based on a simple interest calculation applied annually for certain number of years. The program should display the the balance and the interest earned at the end of each year.

Required functions:

Function displayMyInfo()

This function requires no input and returns no output. It simply displays your full name, your email address and CNIT105 - Loops, to the screen in a box of stars. This function should be invoked at the beginning of the main() function to do its job.

Function main()

Declare variables with proper data type and meaningful names as needed.

Invoke the function to display your info in a box of stars.

Prompt the user to enter investment amount (data type float) Validation: Use a loop to validate the entered amount for being greater than 0.

Prompt the user for the annual interest rate (ex: 3.55) Validation: Use a loop to validate the range of the value entered for being between 2.0 and 7.0 both inclusive.

Prompt the user to enter the number of years the money will be invested. Use a loop to validate the range for being between 2 and 10, both inclusive.

Write a for loop to iterate for the number of years entered to calculate the balance of the investment at the end of each year. Display the year, the interest earned that year and the balance at the end of the year as shown in the screen capture. To calculate these figures, use simple interest calculation as follows:

The interest earned at the end of the year = amount * annual_rate / 100

The balance at the end of the year = amount + interest earned

Update the amount of the investment for the following year (it is the balance at the end of this year).

Function Prototypes: There is only one additional function in this program. Write the function definitions after the main() function, and the prototypes before the main function.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!