Question
1 Problem You have graduated and have a great job! You move to Ottawa and decide that you want to start saving to buy a
1 Problem
You have graduated and have a great job! You move to Ottawa and decide that you want to start saving to buy a house. As housing prices are very high in the Ottawa, you realize you are going to have to save for several years before you can afford to make the down payment on a house.You are going to determine how long it will take you to save enough money to make the down payment given the following assumptions:
-
Call the cost of your dream home total cost.
-
Call the portion of the cost needed for a down payment portion down payment.
For simplicity, assume that portion down payment = 0.25 (25%).
-
Call the amount that you have saved thus far current savings. You start with a
current savings of $0.
-
Assume that you invest your current savings wisely, with an annual return of r (in other words, at the end of each month, you receive an additional current savings*r/12 funds to add into your savings. The division by 12 is because r is an annual rate). Assume that your investments earn a return of r = 0.04 (4%).
-
Assume your annual salary is annual salary.
-
Assume you are going to dedicate a certain amount of your salary each month to saving for the down payment. Call that portion saved. This variable should be in decimal form (i.e. 0.1 for 10%).
-
At the end of each month, your savings will be increased by the return on your in- vestment, plus a percentage of your monthly salary (annual salary / 12). Write a program to calculate how many months it will take you to save up enough money for a down payment. You will want your main variables to be floats, so you should cast user inputs to floats.
Your program should ask the user to enter the values for following variables:
The starting annual salary (annual salary) The portion of salary to be saved (portion saved) The cost of your dream home (total cost)
Try different inputs for annual salary,portion saved,and total cost see how long it takes to save for a down payment for the cost of the house you have entered.Test your program by printing portion saved and no of months for the variable values that you have entered.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started