
- 27 03 2022 18 04 Coding Project Final Jupyter Notebook 27 03 2022 18 04 Coding Project Final Jupyter Notebook Code 1 (143.14 KiB) Viewed 27 times
27/03/2022, 18:04 Coding project final - Jupyter Notebook 27/03/2022, 18:04 Coding project final. Jupyter Notebook Code COMP SCI 1015 IAP - Coding Assigment 1 - House Your program will take the following inputs from the user: Australian Dream, in its narrowest sense, is to own a house. Imagine in three years, you successfully graduate from UniAdelaide, and decide to explore other capital cities in Australia. It is probably a good idea to have a rough idea about how long will it take you to save enough moeny for the up-front payment of your dream home in all capital cities. In this coding assignment, you will write a simple calculator for such calculation. 1. The annual salary (for the variable annual_salary) 2. The portion of salary to be saved (for the variable saving_rate) 3. The price of your dream house (for the variable home_price) The program will then calculate the number of months required to have enough savings ( save_amount ) for the upfront payment of your dream house. Note that the upfront payment required by the bank will include both down payment and stamp duty. In [ ] Program # DO NOT CHANGE THIS CELL down_payment_rate= 0.2 stamp_duty_rate=0.03 tax_rate=0.3 monthly return_rate=0.882 save_amount = 0 Variables Here we defined a series of variables you will use in the program. annual_salary a saving_rate= house_price - Cost of a House home_price: the cost of your dream home. • down_payment_rate : down payment is the cash you pay upfront when you purchase the property. The remaining amount will go into your home mortgage. For example, assume the down payment rate is 30%. If you are purchasing a 1,000,000 house, you will pay 300,000 in cash upfront, and borrow a 700,000 mortgage from the bank. • stamp_duty_rate : you need to pay the stamp duty to the state when you purchase a property. For example, assume the stamp duty rate is 4% and you are purchasing a 1,000,000 house. You will pay 40,000 to the state government. In [ ]: def set_value(sal, rate, price): global annual_salary, saving_rate, house_price annual_salary = sal saving_rate rate house_price = price def cal_upfront(): # INSERT YOUR CODE upfront = ... return upfront def cal_month_to_save_upfront (up_front): # HINT: Calculate these numbers first, then update your saving amount monthly in a Loop return m Salary and Saving • annual_salary: Your annual salary. The average salary of a computer programmer is around 80,000 As a graduate from UniAdelaide, you are highly sought off and your salary will be higher than that! • tax rate : A portion of your salary will go into tax payment. The calculation of tax is complex and we will just use a fixed tax rate in the program. • save_amount : The amount of money you have saved. • saving_rate : The percentage of your after-tax income that goes into saving. For example, with a tax rate of 30% and a saving rate of 10%, the amount you can save per year will be 89,080 (1-0.3) * 0.1 = 5,600 • monthly_return_rate : This number reflects the monthly profit of your investment. For example, assume at December you have a saved amount of 5880. You invested your saving smartly and have a rate of return of 0.1%. It means that your saving will increase by 5000*0.001 - 50 and become 5050 # EXAMPLE 1 set_value(120000, 0.3, 1000000) up_front = cal_upfront) m = cal_month_to_save_upfront (up_front) print(fUpfront is {up_front) and it will take {m} months of saving') # Upfront is 238990.0 and it will take 99 months of saving . # EXAMPLE 2 set_value (100000, 0.2, 680880) up_front = cal_upfront) m = cal_month_to_save_upfront (up_front) print(fUpfront is {up_front) and it will takes {m} months of saving) # Upfront is 138990.0 and it will take 107 months of saving localhost:8888/notebooks/Downloads/Coding project finalipynb 1/3 localhost:8889/notebooks/Downloads Coding project finalipynb 2/3
Coding project final - Jupyter Notebook 27/03/2022, 18:04 Marking criteria: Comments in your code (10%) - You need to provide proper comments in your code. The comments should clearly state the purpose of every code blocks you have. • Program Functions (90%) Reference Index results as at January 31, 2021 Change in dwelling values Total Month Quarter Annual Median value return Sydney 0.4% 1.6% 2.0% 4.6% $879,299 Melbourne 0.4% 2.1% -2.1% 1.1% $692,162 Brisbane 0.9% 2.5% 4.0% 8.3% $527,826 Adelaide 0.9% 3.3% 6.5% 10.8% $473,170 Perth 1.6% 3.8% 3.4% 8.0% $484,280 Hobart 1.6% 3.7% 6.8% 12.1% $523,932 Darwin 2.3% 6.6% 11.4% 17.3% $426,215 Canberra 1.2% 3.7% 8.5% 13.5% $686,524 Combined capitals 0.7% 2.2% 1.7% 5.1% $659,731 Combined regional 1.6% 4.7% 7.9% 12.8% $428,919 National 0.9% 2.8% 3.0% 6.6% $583,157 In 1: