Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Simple interest is the interest paid on a principal sum at a given interest rate over a given number of years. (Wikipedia article) For this

Simple interest is the interest paid on a principal sum at a given interest rate over a given number of years. (Wikipedia article) For this problem, we will keep it simple. Interest rates are annual and the time periods are years. Therefore, the formula for calculating the simple interest is: I=Prt where: I is the simple interest amount P is the principal amount r is the simple annual interest rate t is the number of years INPUT: NOTE The input section of the program is already written for you. This section simply explains what is happening in the given code. There is nothing for you to add or change in the input section. The program receives four lines of input: The principal amount (q float) is stored to a variable called principalAmount. The simple annual interest rate (float) is stored to a variable called interestRate. Note that in this problem, 10.5% would be input as 10.5, not as 0.105. The number of time periods elapsed (integer) is stored to a variable called timePeriods. PROCESSING: Your job in this problem is to: Calculate the simple interest using the formula shown above. Store the simple interest to a variable called simpleInterest. OUTPUT: NOTE The output section of the program is already written for you. This description is here to explain what is happening in the given code. There is nothing for you to add or change in the output section. Given a principal of 100.00, an annual interest rate of 10.5, and 4 time periods, then output would be: Simple interest = $42.00 NOTE The simple interest is displayed to 2 decimal places even though it is $42. This is done using a formatted string for output. EXAMPLES Input Output 100.00 10.5 4 Simple interest = $42.00 1250.56 8.75 15 Simple interest = $1,641.36 20430.50 20.0 10 Simple interest = $40,861.00 5296.78 10.725 12 Simple interest = $6,816.96 50.0 50.0 50 Simple interest = $1,250.00

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

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions