Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. //These functions will compute the real annual cost to a homeowner.
  5. //double interest_payment_amount(double loan_amount);
  6. double total_interest(double loan_amount);
  7. double tax_savings(total_interest);
  8.  
  9. //constants
  10. double loan_interest_rate(0.06);
  11. double loan_reduction_rate(0.03);
  12. double income_tax_rate(0.35);
  13.  
  14.  
  15. int main()
  16. {
  17. double price_of_house, downpayment, total_interest, tax_savings, annual_after_tax_cost;
  18. //constants
  19. // double loan_interest_rate=0.06;
  20. // double loan_reduction_rate(0.03);
  21. // double income_tax_rate(0.35);
  22.  
  23. cout.setf(ios::fixed);
  24. cout.setf(ios::showpoint);
  25. cout.precision(2);
  26.  
  27. while (price_of_house != 0)
  28. {
  29. cout << "Enter the home price (or zero to quit):" <<endl;
  30. cin >> price_of_house;
  31. cout << "Enter the down payment:" << endl;
  32. cin >> downpayment;
  33. double loan = price_of_house - downpayment;
  34. //tax_savings = interest_payment_amount * income_tax_rate;
  35. double interest = total_interest(loan);
  36. //double savings = tax_savings(interest_payment_amount);
  37. //annual_after_tax_cost = total_interest - savings;
  38. cout << "The after-tax cost is " << annual_after_tax_cost << " annually." << endl;
  39. }
  40. return 0;
  41. }
  42. //Function Definitions
  43. //double interest_payment_amount(double loan_amount)
  44. //{
  45. // return (loan_amount * loan_interest_rate) + (loan_amount * loan_reduction_rate);
  46. //}
  47. double total_interest(double loan_amount)
  48. {
  49. return (loan_amount * loan_interest_rate + loan_amount * loan_reduction_rate);
  50. }
  51. double tax_savings(total_interest)
  52. {
  53. return (total_interest * income_tax_rate);
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement