How do make a program to find the annual after-tax?

This is what I have to do and this is what I have so far, but it just finds the interest. How do I find the annual after-tax?

Write a program that computes the annual after-tax cost of a new house for the first year of ownership. The cost is computed as the annual mortgage cost minus the tax savings. The input should be the price of the house and the down payment. The annual mortgage cost can be estimated as 3% of the initial loan balance credited toward paying off the loan principal plus 6% of the initial loan balance in interest. The initial loan balance is the price minus the down payment. Assume a 35% marginal tax rate and assume that interest payments are tax deductible. So, the tax savings is 35% of the interest payment. Your program should use at least two function definitions. Your program should allow the
user to repeat this calculation as often as the user wishes.



Thanks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
using namespace std;

double interest_cal(double rate, double months, double balance);

int main()
{
    double rate, months, interest, balance;
 
     cout << "Please enter the initial balance(Press 0 to end program)\n";
     cin >>  balance;
 
  while (balance != 0)
   { 
    
    cout << "Please enter the rate\n";
    cin >> rate;
    
    cout << "Please enter the number of months\n";
    cin >> months;
    
    rate = rate * 0.01/12;
    interest = interest_cal(rate, months, balance);
    
    cout << "Your interest owed is " << interest << " \n";
    
    cout << "Please enter the initial balance(Press 0 to end program)\n";
    cin >>  balance;

}

    
    system("pause");
         return 0;
}

double interest_cal(double rate, double months, double balance)
{ 
       double interest, total_int = 0;
       for (int count = 1; count <= months; count++)
    {
        interest =  rate * balance;
        balance = balance + interest;
        total_int += interest;
    }
    return total_int;
}
Last edited on
So whats your problem? Write a new function to do the simple math.
Topic archived. No new replies allowed.