Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Homework Assignment 3
- Alfred Ly
- Windows 7, Codeblocks, GCC compiler
- This is a program to calculate your tax owed or tax refund of a person.
- */
- #include <iostream>
- #include <iomanip>
- #include <math.h>
- #include <string>
- using namespace std;
- const double TAXRATE1 = 0.15; //1st tax bracket 15% tax rate
- const double TAXRATE2 = 0.28; //2nd tax bracket 28% tax rate
- const double TAXRATE3 = 0.35; //3rd tax bracket 35% tax rate
- int main(void)
- {
- //declaring variables
- double taxableIncome, taxWithheld, taxowed;
- double tax_liability_one, tax_liability_two, tax_liability_three, total_tax_liability;
- //idFunction
- //receive input from user
- cout << "Enter taxableIncome and taxWithheld" << endl;
- cin >> taxableIncome >> taxWithheld;
- if (taxableIncome < 0)
- else if (taxableIncome <= 36900)
- {
- tax_liability_one = TAXRATE1 * taxableIncome;
- total_tax_liability = tax_liability_one;
- }
- else if(taxableIncome > 36,900 && taxableIncome <= 186,350)
- {
- tax_liability_one = TAXRATE1 * 36900;
- tax_liability_two = TAXRATE2 * (186350-taxableIncome);
- total_tax_liability = tax_liability_one + tax_liability_two;
- }
- else if (taxableIncome > 186350)
- {
- tax_liability_one = TAXRATE1 * 36900;
- tax_liability_two = TAXRATE2 * 186350;
- tax_liability_three = TAXRATE3 * taxableIncome;
- total_tax_liability = tax_liability_one + tax_liability_two + tax_liability_three;
- }
- else
- {
- taxowed = taxWithheld;
- }
- // display out to user
- cout << fixed;
- cout.precision(4);
- //testing
- cout << total_tax_liability <<endl;
- cout << taxWithheld << endl;
- return 0;
- } //ending bracket
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement