Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this question part, you will develop an algorithm that calculates savings by estimating the amount of money that needs to be deposited. Taking into

In this question part, you will develop an algorithm that calculates savings by estimating the amount of money that needs to be deposited. Taking into account the interest you will earn on your savings and the amount you wish to have in your account after a few years, you can determine your deposit.
You should read the question all the way through before you start, to make sure that you understand the scenario.
Background to the problem:
A customer would like to save p pounds over n years to buy a house. The bank suggested different ways to benefit from saving a certain amount of money, such as earning interest for a few years. The bank can calculate the deposit to save p over n years. However, with inflation and potentially increasing house prices, the bank recommends a slightly higher deposit.
We would like to calculate the amount recommended to deposit, given the required future value, the total interest rate and the number of years planned to let the money sit in the account.
We have a deposit, which can be worked out from:
and a recommended deposit:
The problem:
The problem is to write a Python function that will perform these calculations. Specifically, you will produce an estimate of the recommended deposit for the account as follows:
So,
Where is the desired future value that the customer would like to have in the account.
The total interest rate, , depends on the annual interest rate, , and the number of years, n, that are planned to let the money sit in the account. It is calculated as:
Your individual number is tied to the deposit so that there is some margin of error in the estimates, to account for the inflation and potentially increasing house prices.
For example, if the customer would like to save 20,000 in the next eight years and the annual interest rate is 5%, then:
If the individual number is 1.01123, then the recommended deposit (rounded to two decimal places) is:
So,
i.Develop an initial decomposition of the problem using the chevron notation (> and >>) from the module materials. Include your initial decomposition in your solution document.
ii.Building on your initial decomposition for part (c)(i), develop an algorithm for solving the problem. Include this algorithm in your solution document, and also write down your PI and the individual number that you have obtained via Steps 13 from your PI.
iii.Write a Python function definition following the instructions that are provided below.
Important note: in order to raise a quantity to a power, the Python operator ** can be used. So, for example, 2**3 is evaluated as .
Write a single Python function that implements the algorithm you wrote for part (c)(ii). Your function must be a translation of your algorithm from part (c)(ii), otherwise no marks will be awarded.
The function should have three arguments: one for the future savings, future_savings, one for the annual interest rate, annual_interest_rate, and a third for the number of years, nb_years, that the money will grow.
The function should have one return value for the recommended amount needed to deposit, estimated_deposit, which is a double (rounded to two decimal places).
Save your function in a file called Q4_OUCU.py, where OUCU is your OU computer username, e.g. abc123.
When you have completed your work on this part:
paste the function definition from your code file into your solution document as text (with indentation preserved) using an evenly spaced font such Courier New or Consolas
include the code file with your function in your TMA zip file.
iv.Test the function by calling it with the arguments 20000,0.05 and 8 in your Python program. Paste the function call and the result as text into your solution document.
You should aim to use only the Python features that are introduced in the module. If you decide to use techniques or language features that TM112 does not cover, you must give a justification for your decisions, otherwise marks will be lost.

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

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions