12345678910111213141516171819
if (in_marital_status == "s") case_no= (income <= single_level1) || (income<= single_level2); switch (case_no) { case 1: (income <= single_level1); tax = rate1 * income; break; case 2: (income <= single_level2); tax = single_tax1 + rate2 * (income- single_level1);break; case 3: tax = single_tax2 + rate3 * (income-single_level2);break; } if (in_marital_status == "m") case_no= (income <= married_level1) || (income <= married_level2); switch (case_no) { case 1: tax = rate1 * income; break; case 2: tax = married_tax1 + rate2 * (income-married_level1);break; case 3: tax = married_tax2 + rate3 * (income - married_level2);break; }
in_marital_status
' '
" "
case_no
12345678910
if (in_marital_status == "s") { case_no= (income <= single_level1) || (income<= single_level2); switch (case_no) { case 1: (income <= single_level1); tax = rate1 * income; break; case 2: (income <= single_level2); tax = single_tax1 + rate2 * (income- single_level1);break; case 3: tax = single_tax2 + rate3 * (income-single_level2);break; } }