Take a look at the table below to decide how income tax is calculated:
To calculate a person's income tax, we need to decide if a person is married or not. Then based on his or her taxable income, we apply a different tax rate. The decision-making process is shown below.
The taxable income condition is checked after the marital status is checked. As mentioned in 2.7, this is a situation of nested if... else.
B. Sample code: IncomeTax.java