[ create a new paste ] login | about

Link: http://codepad.org/xgWDrIea    [ raw code | output | fork ]

C, pasted on Oct 12:
//Name: Anthony Thomas
//Class; CMPE 30 - 07
//Date: 10/10/17


#include <stdio.h>


int main()
{
	setvbuf(stdin, 0, _IONBF, 0);
	setvbuf(stdout, 0, _IONBF, 0);

	float hourly_rate;
	float annual_income,taxable_income;
	float max_tax,tax_percentage;
	int low,high;
	int P_E = 4050, S_D = 6350;

	printf("\n\n" );
	printf("Anthony's Tax Calculator \n" );
	printf("------------------------------------ \n" );
	printf("Hello user, please enter your current hourly rate ($__/hr): ");
	scanf("%f",&hourly_rate);

	annual_income = hourly_rate * 40 * 52;
	taxable_income = annual_income - P_E - S_D;

	if(taxable_income > 0 && taxable_income <= 9325)
	{
		max_tax = 932.50;
		low = 0;
		tax_percentage = 10;
	}
	else if(taxable_income > 9325 && taxable_income <=37950)
	{
		max_tax = 5226.10;
		low = 9326;
		tax_percentage = 15;
	}
	else if(taxable_income > 37950 && taxable_income <= 91900)
	{
		max_tax = 18713.35;
		low = 37951;
		tax_percentage = 25;
	}
	else if(taxable_income > 91900 && taxable_income <= 191650)
	{
		max_tax = 46643.07;
		low = 91901;
		tax_percentage = 28;
	}
	else if(taxable_income > 191650 && taxable_income <= 416700)
	{
		max_tax = 120909.24;
		low = 191651;
		tax_percentage = 33;
	}
	else if(taxable_income > 416700 && taxable_income <= 418400)
	{
		max_tax = 121503.89;
		low = 416701;
		tax_percentage = 35;
	}
	else if(taxable_income > 418400)
	{
		max_tax = 121503.89;
	    low = 418401;
	    tax_percentage = 39.6;
	}
	else
	{
		max_tax = 0;
		low = 0;
		tax_percentage = 0;
	}

	float tax_due = max_tax + ((taxable_income - low) * tax_percentage);
	float effective_tax = tax_due / annual_income;

	printf("\n");
	printf("Based on your hourly rate of     : $%10.2f\n",hourly_rate);
	printf("Your gross annual salary will be : $%10.2f\n",annual_income);
	printf("Your taxable income is           : $%10.2f\n",taxable_income);
	printf("Your tax bracket is              : %10.2f%%\n",tax_percentage);
	printf("Your expected taxed owed is      : $%10.2f\n",tax_due);
	printf("Your effective tax rate is       : %10.2f%%",effective_tax);

	return 0;
}


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
In function 'main':
Line 68: error: stray '\302' in program
Line 68: error: stray '\240' in program
Line 68: error: stray '\302' in program
Line 68: error: stray '\240' in program
Line 68: error: stray '\302' in program
Line 68: error: stray '\240' in program
Line 69: error: stray '\302' in program
Line 69: error: stray '\240' in program
Line 69: error: stray '\302' in program
Line 69: error: stray '\240' in program
Line 69: error: stray '\302' in program
Line 69: error: stray '\240' in program


Create a new paste based on this one


Comments: