Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose you have a certain amount of money in a savings account that earns compo

ID: 3552186 • Letter: S

Question

Suppose you have a certain amount of money in a savings account that earns compound monthly interest and you want to calculate the amount that you will have after a specific number of months. the formula is F = P X ( 1 + i ) ** t F = future value of the account P = present value of the account i = monthly interest rate t = the number of months. Write a program that prompts the user to enter the accounts present value, monthly interest rate, and number of months that the money will be left in the account. The program should pass these values to a function that returns the future value of the account after the specified number of months. The program should display the accounts future value.



Explanation / Answer

def compoundInterest (p, r, t):

f=p*pow((1+r/100), t)

return f


p=0

while p<=0:

p=float( input(" Enter the present value of the account in dollars : "))

if p<=0:

print(" Invalid value")

r=0

while r<=0 or r>100:

r=float( input(" Enter the monthly interest rate as a percentage :"))

if r<=0 or r>100:

print(" Invalid Value")

t=0

while t<=0:

t=float(input(" Enter thr number of months :"))

if t<=0:

print(" Invalid Value")


f=compoundInterest(p, r, t)

print(" Present Value : $", p)

print(" Interest Rate : % ", r)

print(" After ",t , " months, the value of your account will be $ ", f)


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote