2008年3月24日 星期一

Lab: Tax Calculation

import java.util.Scanner;

public class TaxCalculation
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner (System.in);
System.out.println("Enter net income:");

double netIncome = keyboard.nextInt();
double tax;

if (netIncome<=370000)
tax=netIncome*0.06;
else if((netIncome>370000)&&(netIncome<=990000))
tax=netIncome*0.13-25900;
else if ((netIncome>990000)&&(netIncome<=1980000))
tax=netIncome*0.21-105100;
else if ((netIncome>1980000)&&(netIncome<=3720000))
tax=netIncome*0.30-283300;
else if (netIncome>3720000)
tax=netIncome*0.40-655300;
else
tax=0.0;

System.out.print("總共需要");
System.out.printf("%10.2f",tax);
System.out.println("元");
}
}

結果:
1000000的稅




2000000的稅

沒有留言: