// ex_ch7_10.c
#include <stdio.h>
#include <stdbool.h>

const char* STARS = "******************************" \
"***********************************\n";

int main(void)
{
	int choice, wages, first, excess;
	float excess_tax;
	while(true)
	{
		printf(STARS);
		printf("1) Single\t\t2) Head of Household\n"
			"3) Married, Joint\t4) Married, Separate\n");
		printf("5) Quit\n");
		printf(STARS);
		scanf("%d", &choice);
		if (choice == 5)
			return 0;

		printf("Input wages: ");
		scanf("%d", &wages);

		switch(choice)
		{
		case 1:
			first = 17850;
			break;
		case 2:
			first = 23900;
			break;
		case 3:
			first = 29750;
			break;
		case 4:
			first = 14875;
			break;
		}
		excess = wages - first;
		if (excess > 0)
			excess_tax = 0.28 * excess;
		else
			excess_tax = 0.0;

		printf("Taxes to pay: %f\n", 0.15 * first + excess_tax);
	}
	return 0;
}