名稱:

星期一, 10月 17, 2005

LAB

package untitled10;

/**
*

Title:


*
*

Description:


*
*

Copyright: Copyright (c) 2005


*
*

Company:


*
* @author not attributable
* @version 1.0
*/
public class Untitled1 {
public static void main(String[] arg ) {
double netIncome, tax, fivePercentTax, tenPercentTax;
netIncome= 50000;

System.out.println("Enter net income=50000.\n"
+ "Do not include a dollar sign or any commas.");


if (netIncome <= 15000) tax = 0; else if ((netIncome > 15000) && (netIncome <= 30000)) //tax = 5% of amount over $15,000 tax = (0.05*(netIncome - 15000)); else //netIncome > $30,000
{
//fivePercentTax = 5% of income from $15,000 to $30,000.
fivePercentTax = 0.05*15000;
//tenPercentTax = 10% of income over $30,000.
tenPercentTax = 0.10*(netIncome - 30000);
tax = (fivePercentTax + tenPercentTax);
}

System.out.println("Tax due = " +tax);


}
}

0 Comments:

張貼留言

<< Home