Question: Requirements ? Print all floats to 2 decimal points unless stated otherwise ? You MUST use loops to solve this problem Restrictions ? No global
Requirements
? Print all floats to 2 decimal points unless stated otherwise
? You MUST use loops to solve this problem
Restrictions
? No global variables may be used
? Your program must have at least 1 user defined function
Description
For this problem you will be figuring out if it is more beneficial to pay off your loans first before
investing or if you should only make the minimum payments and invest the rest.
Some things to pay attention to
? Interest rates given are annual interests rates but we will be assuming that interest is
compounded monthly so the real rates to use will be 1/12 of what we are given
? We will assume that interest is compounded on our accounts before any payments or
contributions are made to them
? If the user has not finished paying off all of their loans when they retire they immediately pay
off their loans from their savings
? It is ok for savings to become negative because of this
Cautions about using this program for your own investment strategies
? All investments inherently carry risk with them
? This program assumes you are putting your money in a Roth IRA
? There is an easier way to solve this problem in real life. Remind me to tell you about it.
Assumptions
? Input will not always be valid
? If invalid input is received your program should continue to ask for more input until a
valid value is entered
? While input may be invalid it will always be of the correct type
Valid values for inputs
? Loans: A real number >= 0
? Annual loan interest rate: a real number >= 0
? Minimum payment: a real number >= 0
? Investment money: A real number >= minimum payment
? Current age: an integer >= 0
? Retirement age: an integer >= current age
? Annual rate of return: a real number >= 0
Hints
? This problem has no relationship to the monthly payment formula that we did in homework 1.
Don't try and use it
? Don't try and look up a closed form solution to this problem. I'm not sure if there is one and
the program requires you to use loops, so if you find one you couldn't use it anyway
? When solving this problem think about what you would do in real life when paying off your
loans / savings and have your program do that as well
? Make sure that you handle the month where you fully pay off your loans correctly. During that
month your loans might be less than your minimum payment
Examples
Example 1
Enter how much money you owe in loans: 42085.86
Enter the annual interest rate of the loans: 0.12
Enter your minimum monthly loan payment: 377.83
Enter how much money you will be putting towards loans/retirement each
month: 1176.53
Enter your current age: 33
Enter the age you plan to retire at: 60
Enter your predicted annual rate of return: .09
You should only make minimum payments on your loans and invest the rest
If you do you will have $1109488.57 as opposed to $946336.28 when you
retire.
Example 2
Enter how much money you owe in loans: 50000
Enter the annual interest rate of the loans: 0.06
Enter your minimum monthly loan payment: 350
Enter how much money you will be putting towards loans/retirement each
month: 1053
Enter your current age: 25
Enter the age you plan to retire at: 70
Enter your predicted annual rate of return: 0.05
You should pay of all of your loans before you start investing
If you do you will have $1651149.44 as opposed to $1619732.68 when you
retire.
Example 3
Enter how much money you owe in loans: 10000
Enter the annual interest rate of the loans: .02
Enter your minimum monthly loan payment: 100
Enter how much money you will be putting towards loans/retirement each
month: 500
Enter your current age: 18
Enter the age you plan to retire at: 20
Enter your predicted annual rate of return: 0.07
You should only make minimum payments on your loans and invest the rest
If you do you will have $2311.22 as opposed to $1835.38 when you retire.
Example 4
Enter how much money you owe in loans: -3
Enter how much money you owe in loans: -2
Enter how much money you owe in loans: 25000
Enter the annual interest rate of the loans: -2
Enter the annual interest rate of the loans: -8
Enter the annual interest rate of the loans: -17
Enter the annual interest rate of the loans: .04
Enter your minimum monthly loan payment: -3
Enter your minimum monthly loan payment: 500
Enter how much money you will be putting towards loans/retirement each
month: 2
Enter how much money you will be putting towards loans/retirement each
month: 5
Enter how much money you will be putting towards loans/retirement each
month: 300
Enter how much money you will be putting towards loans/retirement each
month: 600
Enter your current age: -9
Enter your current age: 25
Enter the age you plan to retire at: 12
Enter the age you plan to retire at: 13
Enter the age you plan to retire at: 68
Enter your predicted annual rate of return: -9
Enter your predicted annual rate of return: .03
You should pay of all of your loans before you start investing
If you do you will have $538083.32 as opposed to $537722.67 when you
retire.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
