assignment #3

# assignment #3 - tax = MarriedTax(income t display 2 digits...

This preview shows pages 1–2. Sign up to view the full content.

Amanda Drobney October 24,2010 Assignment #3 A #include <iostream> #include <iomanip> # using namespace std; u // calculate the tax for single double SingleTax( double income); // calculate the tax for married double MarriedTax( double income); d int main() { double income; char type; double tax; d // ask the user to enter the income cout << "Enter your income: "; cin >> income; while (income <= 0) { cout << "Enter positive number: "; cin >> income; } // ask the user to enter the status cout << "Enter the status(S for single, M for married): "; cin >> type; { cout << "Enter 'S' or 'M': "; cin >> type; } // calculate the tax if (type == 'S') tax = SingleTax(income); else

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: tax = MarriedTax(income); t // display 2 digits after point cout << fixed << setprecision(2); c // display the result cout << "The tax is \$" << tax << endl; c return 0; } double SingleTax( double income) { if (income <= 21450) // 0 - 21450 return income * 0.15; else if (income <= 51900) // 21450 - 51900 return 3217.5 + (income - 21450) * 0.28; r // > 51900 return 11743.5 + (income - 51900) * 0.31; } double MarriedTax( double income) { if (income <= 35800) // 0 - 35800 return income * 0.15; else if (income <= 86500) // 35800 - 86500 return 5370 + (income - 35800) * 0.28; r // > 35800 return 19566 + (income - 86500) * 0.31; }...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

assignment #3 - tax = MarriedTax(income t display 2 digits...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online