import java.util.*;
public class TaxCalculator
{
	public static void main(String[] args)
	{
		// Use can use constants here so if the values change,
		// you only have to change them in one place. Here.
		final int SINGLE_DEDUCTION = 5150;
		final int MARRIED_DEDUCTION = 10300;
		final int NONDEPENDENT_DEDUCTION_SINGLE = 3300;
		final int NONDEPENDENT_DEDUCTION_MARRIED = 6600;

		// Create a scanner for user input
		Scanner scan = new Scanner(System.in);
	
		// Prompt user for tax data
		System.out.println("Input your marital status [S=single, M=married]:");
		char maritalStatus = scan.nextLine().toUpperCase().charAt(0);
		System.out.println("Input your dependent status [N=nondependent, D=dependent]:");
		char dependentStatus = scan.nextLine().toUpperCase().charAt(0);
		System.out.println("Input your wages as an integer:");
		int wages = scan.nextInt();
		System.out.println("Input your unemployment compensation as an integer:");
		int unemployment = scan.nextInt();
		System.out.println("Input your bank interest as an integer:");
		int interest = scan.nextInt();

		// Compute the total income

		int totalIncome = wages + unemployment + interest;

		int taxableIncome = totalIncome;

		// Adjust for deduction based on marital status
		if (maritalStatus == 'S')
			taxableIncome -= SINGLE_DEDUCTION;
		else if (maritalStatus == 'M')
			taxableIncome -= MARRIED_DEDUCTION;

		// Adjust for deduction based on dependent status, if applicable
		if (dependentStatus == 'N')
		{
			if (maritalStatus == 'S')
				taxableIncome -= NONDEPENDENT_DEDUCTION_SINGLE;
			else if (maritalStatus == 'M')
				taxableIncome -= NONDEPENDENT_DEDUCTION_MARRIED;
		}

		if (taxableIncome < 0)
			taxableIncome = 0;

		System.out.println("TAXABLE INCOME: $" + taxableIncome);

		// ADDITIONAL EXERCISE

		double taxDue;
		if (taxableIncome <= 25000)
			taxDue = 0.05 * taxableIncome;
		else if (taxableIncome < 60000)
			taxDue = 1250 + 0.10*(taxableIncome-25000);
		else
			taxDue = 4750 + 0.20*(taxableIncome-60000);
		
		System.out.println("TAX DUE: $" + taxDue);

	}

}
