Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- //These functions will compute the real annual cost to a homeowner.
- //double interest_payment_amount(double loan_amount);
- double total_interest(double loan_amount);
- double tax_savings(total_interest);
- //constants
- double loan_interest_rate(0.06);
- double loan_reduction_rate(0.03);
- double income_tax_rate(0.35);
- int main()
- {
- double price_of_house, downpayment, total_interest, tax_savings, annual_after_tax_cost;
- //constants
- // double loan_interest_rate=0.06;
- // double loan_reduction_rate(0.03);
- // double income_tax_rate(0.35);
- cout.setf(ios::fixed);
- cout.setf(ios::showpoint);
- cout.precision(2);
- while (price_of_house != 0)
- {
- cout << "Enter the home price (or zero to quit):" <<endl;
- cin >> price_of_house;
- cout << "Enter the down payment:" << endl;
- cin >> downpayment;
- double loan = price_of_house - downpayment;
- //tax_savings = interest_payment_amount * income_tax_rate;
- double interest = total_interest(loan);
- //double savings = tax_savings(interest_payment_amount);
- //annual_after_tax_cost = total_interest - savings;
- cout << "The after-tax cost is " << annual_after_tax_cost << " annually." << endl;
- }
- return 0;
- }
- //Function Definitions
- //double interest_payment_amount(double loan_amount)
- //{
- // return (loan_amount * loan_interest_rate) + (loan_amount * loan_reduction_rate);
- //}
- double total_interest(double loan_amount)
- {
- return (loan_amount * loan_interest_rate + loan_amount * loan_reduction_rate);
- }
- double tax_savings(total_interest)
- {
- return (total_interest * income_tax_rate);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement