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);
}
}
導覽連結: 首頁 -> 標題: Lab: Tax Calculation
2007年10月12日 星期五
Lab: Tax Calculation
ARTICLE LABELS: Java
訂閱:
張貼留言 (Atom)
0 COMMENT:
張貼留言