Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

INTRODUCTION: Compound interest is the interest paid on a principal sum and any accumulated interest at a given interest rate over a given number of

INTRODUCTION:

Compound interest is the interest paid on a principal sum and any accumulated interest at a given interest rate over a given number of years.

Once again, we will keep things simple and deal with annual rates and time in years. The formula for total compound interest generated is:

I=P(1+rn)ntP=(1+)

Where:

I is the total compound interest

P is the initial principal

r is the annual interest rate

n is the compounding frequency. For this problem, the frequency is always once a year.

t is the time in years

INPUT:

Using the input sections from Problems 1 and 2 as examples, write your own input section to input values for the following:

Input and store the initial principal (float) to a variable called initialPrincipal.

Input and store the annual interest rate as a percentage (float) to a variable called interestRate. Note that in this problem, 10.5% would be input as 10.5, not as 0.105.

Input and store the number of years that have elapsed (integer) to a variable called numberOfYears.

PROCESSING:

Your job for the processing section is to:

Create a variable called timesPerYear and set it equal to 1. This will be the compounding frequency in the formula.

Calculate the total compound interest generated using the formula above.

Store the interest amount to a variable called totalInterest.

OUTPUT:

Use the output section of Problem 2 as an example and write your own output section to print the following:

Given 100.00 as the initial principal and 10.5 as the interest rate, which is applied once a year for 4 years, the output would be:

Compound interest = $49.09

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

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions