Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- const double S_ONE = 863;
- const double S_TW0 = 864;
- const double S_THREE = 2588;
- const double S_FOUR = 2589;
- const double S_FIVE = 4313;
- const double M_ONE = 1726;
- const double M_TW0 = 5176;
- const double M_THREE = 5177;
- const double M_FOUR = 8626;
- const double M_FIVE = 4313;
- int main()
- {
- double income;
- double tax;
- double rates[] = {0.023,0.033,0.052,0.075};
- double single[] = {25,85,181};
- double married[] = {40,175,390};
- cout << "please enter your income: ";
- cin >> income;
- cout << "martial please enter your martial status (s or m):" ;
- string martialStatus;
- cin >> martialStatus;
- if (martialStatus == "s")
- {
- if (income <= 0 || income >= S_ONE)
- {
- tax = ((income - 0) * rates[1]) + 0;
- cout << "your income tax is: " << tax;
- }
- else if (income <= S_TW0 || income >= S_THREE)
- {
- tax = ((income - S_ONE) * rates[2]) + single[1];
- cout << "your income tax is: " << tax;
- }
- else if (income <= S_FOUR || income >= S_FIVE)
- {
- tax = ((income - S_THREE) * rates[3]) + single[85];
- cout << "your income tax is: " << tax;
- }
- else if (income <= S_FIVE)
- {
- tax = ((income - S_FIVE) * rates[4]) + single[3];
- cout << "your income tax is: " << tax;
- }
- }
- else
- {
- if (income <= 0 || income >= M_ONE)
- {
- tax = ((income - 0) * rates[1]) + 0;
- cout << "your income tax is: " << tax;
- }
- else if (income <= M_TW0 || income >= M_THREE)
- {
- tax = ((income - M_ONE) * rates[2]) + single[1];
- cout << "your income tax is: " << tax;
- }
- else if (income <= M_FOUR || income >= M_FIVE)
- {
- tax = ((income - S_THREE) * rates[3]) + single[85];
- cout << "your income tax is: " << tax;
- }
- else if (income <= M_FIVE)
- {
- tax = ((income - M_FIVE) * rates[4]) + single[3];
- cout << "your income tax is: " << tax;
- }
- }
- cin.get();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement