-->

2007年10月12日 星期五

Lab: Tax Calculation

Study Display 3.1. Based on the income tax rate in Taiwan,calculate the income tax of a person whose annual income is 1,000,000 or 2,000,000.

Ans:
import java.util.Scanner;

public class IncomeTax
{
public static void main (String[] args)
{
Scanner keyboard = new Scanner(System.in);
double netIncome, tax;
System.out.println("Enter the income.");
netIncome = keyboard.nextDouble( );

if (netIncome <= 370000)
tax = (0.06*netIncome);
else if (netIncome <= 990000)
tax = (0.13*netIncome - 25900);
else if (netIncome <= 1980000)
tax = (0.21*netIncome - 105100);
else if (netIncome <= 3720000)
tax = (0.30*netIncome - 283300);
else
tax = (0.40*netIncome - 655300);
System.out.println("Tax due = "+tax);
}

}


0 COMMENT: