Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please, using C language, not C+or C++. Thanks. Files to submit: investments.c Time it took Matthew to Complete: 30 mins Requriements Program must compile with

Please, using C language, not C+or C++. Thanks.

Files to submit: investments.c

Time it took Matthew to Complete: 30 mins

Requriements

Program must compile with both -Wall and -Werror options enabled

Submit only the files requested

Use doubles to store real numbers

Print all doubles to 2 decimal points unless stated otherwise

Restrictions

No global variables may be used

Your main function may only declare variables and call other functions

You must use loops to solve this problem

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 before they retire a warning message should be printed

Cautions about using this program for your own investment startegies

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 validIf invalid input is received your program should continue to ask for more input until a valid value is entered

The exception for this is if the money set aside for investments each month is less than the minimum payment on the loan. If it is the program should terminate.

White space after desired input is allowed

You will probably want to wait until after we cover how to do this in class before handling it

Valid values for inputs

Investment money: A real number >= minimum payment

If it is not the program should terminate

Loans: A real number >= 0

Annual loan interest rate: a real number >= 0

Minimum payment: a real number >= 0

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 any way

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

Examples

Example 1

Enter how much money you will be putting towards loans/retirement each month: 500 Enter how much you owe in loans: 40000 Enter the annual interest rate of the loans: 0.03 Enter your minimum monthly loan payment: 405.32 Enter your current age: 22 Enter the age you plan to retire at: 65 Enter the annual rate of return you predict for your investments: .05 You should only make the minimum payments on your loan and apply the rest towards retirement. If you do you will have $592888.96 when you retire as opposed to $587281.54 if you payed off your loan before investing.

Example 2

Enter how much money you will be putting towards loans/retirement each month: 1053 Enter how much you owe in loans: 50000 Enter the annual interest rate of the loans: 0.06 Enter your minimum monthly loan payment: 350 Enter your current age: 25 Enter the age you plan to retire at: 70 Enter the annual rate of return you predict for your investments: 0.05 You should apply all $1053.00 towards your loan before making any investments. If you do you will have $1651149.44 when you retire as opposed to $1619732.68 if you only made minimum payments.

Example 3

Enter how much money you will be putting towards loans/retirement each month: 50 Enter how much you owe in loans: 1000 Enter the annual interest rate of the loans: 0.05 Enter your minimum monthly loan payment: 400 You didn't set aside enough money to pay off our loans. Ending program.

Example 4

Enter how much money you will be putting towards loans/retirement each month: 500 Enter how much you owe in loans: 10000 Enter the annual interest rate of the loans: .02 Enter your minimum monthly loan payment: 100 Enter your current age: 18 Enter the age you plan to retire at: 20 Enter the annual rate of return you predict for your investments: 0.07 Warning! After you retire you will still have $7961.19 in loans left. You should only make the minimum payments on your loan and apply the rest towards retirement. If you do you will have $10272.41 when you retire as opposed to $1835.38 if you payed off your loan before investing.

Example 5

Enter how much money you will be putting towards loans/retirement each month: bob Enter how much money you will be putting towards loans/retirement each month: cat Enter how much money you will be putting towards loans/retirement each month: -3 Enter how much money you will be putting towards loans/retirement each month: 250 Enter how much you owe in loans: something Enter how much you owe in loans: 25 boys Enter how much you owe in loans: 1000 Enter the annual interest rate of the loans: ziggy Enter the annual interest rate of the loans: -3 Enter the annual interest rate of the loans: .1 Enter your minimum monthly loan payment: 50 50 Enter your minimum monthly loan payment: 25 Enter your current age: -5 Enter your current age: 20 Enter the age you plan to retire at: 18 Enter the age you plan to retire at: 65 Enter the annual rate of return you predict for your investments: -8 Enter the annual rate of return you predict for your investments: 0.04 You should apply all $250.00 towards your loan before making any investments. If you do you will have $371259.10 when you retire as opposed to $370579.15 if you only made minimum payments.

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

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions