Question

A group of new college graduates want to know if they save a certain amount of...

A group of new college graduates want to know if they save a certain amount of money every month for a certain amount of years, how much saving they are going to get after certain amount of time.

Write a python program to help them out.

Ask the user to input how much they plan to save per month; how many years (integer) they are going to keep on saving the money; every how many years do they expect to get a raise and put more money in this saving account; what’s the percentage increase to the monthly deposit; and what’s the saving account interest rate (yearly). Assume the bank distributes the interest every month. At the end of each month, the amount of money in the saving account should be:

End of the month balance = (previous end of the month balance + monthly deposit)* (1+monthly interest rate)

Display the break down details of the calculation.

Example: If the user deposit $100 per month for 2 years, and increase the deposit by 10% per year ($110 after one year) at bank interest 12% per year, show the user,

Year#, Month#, deposit, ending balance of the month

0 1 100.0 101.0

0 2 200.0 203.01

1 1 1310.0 1404.84

1 12 2520.0 2852.41

If you deposit $100 per month for 2 years, and increase the deposit by 10% per year, at bank interest 12%, you will have $2852.41 saved at the end of 2 years

Then ask the users if they want to try again, if they do, go with another iteration. If they don’t want to try again, thank the user for using the program.

What I have complete (Basically can't figure out how to calculate it, and print it):

def program_start():
print('-------------------------------------------')
print('Program main menu, please select an option:')
print('-------------------------------------------')
print('1. Begin Calculation')
print('2. Quit')
print('-------------------------------------------')
chosen_number = int(input('Enter desired option here [1, 2]: '))
if chosen_number == 1:
main()
elif chosen_number == 2:
print('Exiting...')
else:
print('-------------------------------------------')
print('Invalid selection...')
program_start()

def user_input():
initial_savings = float(input('How much do you initially plan to save?: '))
years_save = int(input('How many years do you plan to save that amount for?: '))
increase_percentage = float(input('What percent do you plan to increase each month? '))
interest = float(input('What is the interest rate yearly?: '))
return initial_savings, years_save, increase_percentage, interest
calculate(initial_savings, years_save, increase_percentage, interest)

def calculate(initial_savings, years_save, increase_percentage, interest):
INTEREST_CONSTANT = 1
end_balance = (initial_savings+increase_percentage)*(INTEREST_CONSTANT+interest)
print('End period balance is, ','$',format(end_balance,'.2f'), sep='')

def main():
initial_savings, years_save, increase_percentage, interest = user_input()
calculate(initial_savings, years_save, increase_percentage, interest)
  
program_start()

0 0
Add a comment Improve this question Transcribed image text
Answer #1

'''
Python version : 3.6
Python program to calculate the total savings
'''

def program_start():
   print('-------------------------------------------')
   print('Program main menu, please select an option:')
   print('-------------------------------------------')
   print('1. Begin Calculation')
   print('2. Quit')
   print('-------------------------------------------')
   chosen_number = int(input('Enter desired option here [1, 2]: '))
   if chosen_number == 1:
       main()
   elif chosen_number == 2:
       print('Exiting...')
   else:
       print('-------------------------------------------')
       print('Invalid selection...')
   # if not exit, continue  
   if chosen_number != 2:
       program_start()

def user_input():
   initial_savings = float(input('How much do you initially plan to save?: '))
   years_save = int(input('How many years do you plan to save that amount for?: '))
   increase_percentage = float(input('What percent do you plan to increase each year? '))
   interest = float(input('What is the interest rate yearly?: '))
   return initial_savings, years_save, increase_percentage, interest
  
def calculate(initial_savings, years_save, increase_percentage, interest):
   months_save = years_save*12 # calculate total months of saving
   monthly_interest = interest/1200 # calculate monthly interest
   monthly_deposit = initial_savings # set monthly deposit to initial_savings initially
   total_deposit = 0 # for storing total deposit
   year = 0
   month = 0
   num_months = 0
   balance = 0 # for staoring balance
   # print the header
   print('%10s%10s%10s%30s' %('Year#','Month#','deposit','ending balance of the month'))
   # loop that continues for months_save number of times
   while(num_months < months_save):
       num_months += 1 # increment the number of months
       # increment monthly each year, after one year
       if(num_months%13 == 0):
           monthly_deposit = monthly_deposit*(1+increase_percentage/100);
       # update the month and year
       month += 1
       if month > 12:
           month = 1
           year += 1  
      
       # add monthly_deposit to total_deposit
       total_deposit += monthly_deposit
       # calculate end balance
       balance = (balance+monthly_deposit)*(1+monthly_interest)
       # print the parameters
       print('%10d%10d%10.2f%20.2f' %(year,month,total_deposit,balance))
      
   print('\nEnd period balance is $%.2f' %balance)

def main():
   initial_savings, years_save, increase_percentage, interest = user_input()
   calculate(initial_savings, years_save, increase_percentage, interest)

program_start()  

Code Screenshot:

Output:

Add a comment
Know the answer?
Add Answer to:
A group of new college graduates want to know if they save a certain amount of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Suppose you want to deposit a certain amount of money into a savings account and then...

    Suppose you want to deposit a certain amount of money into a savings account and then leave it alone to draw interest for the next 10 years. At the end of 10 years you would like to have $10,000 in the account. How much do you need to deposit today make that happen? You can use the following formula, which is known as the present value formula, to find out:                                    P = F / (1+ r)^n The terms in...

  • P5.3      Present Value. Suppose you want to deposit a certain amount of money into a savings...

    P5.3      Present Value. Suppose you want to deposit a certain amount of money into a savings account and then leave it alone to draw interest for the next 10 years. At the end of 10 years you would like to have $10,000 in the account. How much do you need to deposit today tomake that happen? You can use the following formula, which is known as the present value formula, to find out: P = F/(1+r)^n The terms in the...

  • 7. You plan to establish a college education fund for your child. The current cost for...

    7. You plan to establish a college education fund for your child. The current cost for college is $12,000 per year and you expect this cost to increase by $600 per year. You plan to deposit money into an account earning 10% yearly nominal interest, compounded monthly, at the end of each year for the next 17 years. You will withdraw the amount required for college in the end of years 18 to 21 to pay for college for years...

  • Problem 1- Saving Money You want to deposit money into a bank account that pays 1.5%...

    Problem 1- Saving Money You want to deposit money into a bank account that pays 1.5% compounded monthly. Answer the following questions: f depositing $4000, how much is avaiable in the account at the end of S years? .How much do you have to deposit now in order to have $5000 available at the end of 5 years? Instead of depositing one sum of money at the beginning of the 5-year period, suppose you wish to make monthly payments. How...

  • cation fund for your child. The current cost for college 7 You plan to establish a...

    cation fund for your child. The current cost for college 7 You plan to establish a college education fund for your child. The 000 per vear and you expect this cost to increase by $600 per year. You plan to deposit money into an account earning 10% yearly nominal interest, compounde monthly, at the end of each year for the next 17 years. You will withdraw the ar required for college in the end of years 18 to 21 to...

  • Visual C# Create Present Value application Application that lets you deposit a certain amount of money...

    Visual C# Create Present Value application Application that lets you deposit a certain amount of money into a savings account and then leave it alone to draw interest for the next 10 years. At the end of 10 years you would like to have $10,000 in the account. How much do you need to deposit today to make that happen? You can use the following present-value formula, to find out. P =F/(1+r)^n P is the present value, or the amount...

  • You want to save for your child’s college. Your child will start to college in 18...

    You want to save for your child’s college. Your child will start to college in 18 years and you want to have $152698 at that time. You find a saving plan that will pay 6.0% compounded weekly (52 times per year). How much will you have to deposit weekly to accomplish this?

  • 1. You would like to save $70 000 in 10 years. To accumulate this amount, you...

    1. You would like to save $70 000 in 10 years. To accumulate this amount, you plan to make a regular deposit with an equal amount of cash into a saving account at the end of each year. This account will earn 6% p.a interest compounded annually. Your first payment will be made at the end of this year. a. How much must you deposit annually to accumulate this amount in 10 years? b. If you decide to make a...

  • You just graduated from college and are starting your new job. You realized the importance to...

    You just graduated from college and are starting your new job. You realized the importance to save for the future and have figured out that you will save $1,000 per month for the next 15 years; and then increase to $7,000 per month for the following 4 years. The amount accumulated at the end of these investments will be your retirement egg nest. You plan to start retirement and start withdrawing monthly amounts the following month (you will be in...

  • Suppose you want to save in order to purchase a new boat. Take the APR to be 6.0%.

     Suppose you want to save in order to purchase a new boat. Take the APR to be 6.0%. If you deposit $250 each month, how much will you have toward the purchase of a boat after three years? (Round your answer to the nearest cent.) You plan to work for 40 years and then retire using a 25-year annuity. You want to arrange a retirement income of $4300 per month. You have access to an account that pays an APR of 4.8%...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT