You have graduated from CU Boulder and have a great job! You moved to Seattle and decided to save money to buy a house. Write a program to determine how many months it will take you to save enough money to make the down payments given the following assumptions: The portion of the cost needed for a down payment is 25% (0.25) Since you just graduated, the current saving is 0 Assume you invest your current savings wisely. At the end of each month, you receive additional funding, currentSaving * r / 12 where r

Respuesta :

Answer:

#include <iostream>

using namespace std;

int main()

{

double annual_salary, save_percent, cost, current_savings = 0, r=0.04;

int months = 0;

cout<<"Enter your annual salary:"<<endl;

cin>>annual_salary;

cout<<"Enter the percent of your salary to save, as a decimal:"<<endl;

cin>>save_percent;

cout<<"Enter the cost of your dream house:"<<endl;

cin>>cost;

while(current_savings<(cost/4.0))

{

current_savings = current_savings + ((annual_salary/12.0)*save_percent) + (current_savings*(r/12.0));

months++;

}

cout<<"Number of months: "<<months;

return 0;

}