请各位高手不吝赐教,JAVA程序问题
总共两个文件TaxTest.java与Tax.java
---------------------------------------------------------------------------------------
TaxTest.java
===========================================
import javax.swing.JOptionPane;
public class TestTax{
public static void main(String[] args){
String yearString = JOptionPane.showInputDialog("Enter the year ,etc 2001 or 2002");
int year = Integer.parseInt(yearString);
Tax change = new Tax();
change.setBrackets(year);
change.setRates(year);
int[][] brackets = change.getBrackets();
double[] rates = change.getRates();
double taxableIncome = change.getTaxableIncome();
double tax = 0;
System.out.println(year + " year Ameica duty of four persons");
System.out.println("-----------------------------------------------------");
System.out.println("taxableIncome SINGLE_FILER MARRIED_JOINTLY MARRIED_SEPARATELY HEAR_OF_HOUSHOLD");
System.out.println("-----------------------------------------------------");
for(double i = taxableIncome;i <= 60000;){
System.out.println(taxableIncome );
for(int filingStatus = 0;filingStatus <= 3;filingStatus ++){
if(taxableIncome <= brackets[filingStatus][0])
tax = taxableIncome * rates[0];
else tax = brackets[filingStatus][0] * rates[0];
for(int j = 1;j < brackets[0].length;j ++){
if(taxableIncome < brackets[filingStatus][j])
tax += (brackets[filingStatus][j]-brackets[filingStatus][j-1])*rates[j];
else tax += (taxableIncome -brackets[filingStatus][j-1])*rates[j];
}
System.out.println(" " + tax);
}
taxableIncome += 1000;
System.out.println();
}
System.out.println("-----------------------------------------------------");
}
}
Tax.java
=============================================
public class Tax{
private int filingStatus = 0;
private int[][] brackets;
private double[] rates;
private double taxableIncome;
publ
相关文档:
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--每页显示记录条数
@currentpage int output,--第几页
@orderid nvarchar(50),--主键排序
@sort int,--排序方式,1表示升序,0表示降序排列
......
java中时间戳和时间字符串之间的转换
获取当前的unix时间戳
new Date().getTime()
System.currentTimeMillis()
返回的是毫秒数,要转换long t = System.currentTimeMillis()/1000;
获取当前年月日以及时分秒
Calendar c = Calendar.getInstance();
c.get(Calendar.YEAR)) c.get(Calendar.YEAR)) c.get(C ......
一、背景
最近一年多来,在Internet上出现的特别吸引人的事件就是Java语言和用Java编写的浏览器HotJava。
1991年,SUNMicroSystem公司的JameGosling、BillJoe等人,为在电视、控制烤面包箱等家用消费类电子产品上进行交互式操作而开发了一个名为Oak的软件(即一种橡树的名字),但当时并没有引起人们的注意,直到1 ......
如果从翻看Thinking in java 这书算起,那我已经看了差不多三个月了,但是事实上真正把花在思考JAVA问题上的时间算下,可真是让自己都有点说不过去。种种理由都充斥着我的神经,但无非都是懒惰者的自我保护的手段,我不得不感慨真的是自己太不上进了。
&nbs ......