Perform the following steps with pen and paper - you should not write code for these steps:
Question:
Perform the following steps with pen and paper - you should not write code for these steps:
- Write down your PI (personal identifier).Your PI will be different from your OUCU, but like your OUCU it is unique to you. The PI starts with a letter followed by six digits, followed by a check value, which is either a digit or letter.
- Identify the last three numerical digits that occur in your PI. So, for instance, if your PI is A987654X, you'd take 654. If your PI is Z1234567, you'd take 567.
- Use the three digits from Step 2, let's call them XYZ, to create the number 1.01XYZ. For instance, if you obtained 654 in Step2, then you now get 1.01654. If you obtained 567, you would get 1.01567.
In your solution document, in answer to Part (ii) below, write down your PI and the individual number that you have obtained via Steps 1-3 from your PI.
We ask you to make use of the individual number based on your PI so you can demonstrate that your solution to this question part is your own.
If you are unclear about how to use your PI to arrive at the individual number, do not hesitate to ask your tutor for advice.
Please state your full PI and the individual number you obtained, so your tutor can establish that the digits you use for XYZ in 1.01XYZ correspond with the final three digits of your PI.
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 Steps1-3 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.
- 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.
Human Resource Management
ISBN: 978-0538453158
13th Edition
Authors: Robert L. Mathis, John H. Jackson