请各位高手不吝赐教,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
相关文档:
一、背景
最近一年多来,在Internet上出现的特别吸引人的事件就是Java语言和用Java编写的浏览器HotJava。
1991年,SUNMicroSystem公司的JameGosling、BillJoe等人,为在电视、控制烤面包箱等家用消费类电子产品上进行交互式操作而开发了一个名为Oak的软件(即一种橡树的名字),但当时并没有引起人们的注意,直到1 ......
1、JAVA读取文件,避免中文乱码。
/**
* 读取文件内容
*
* @param filePathAndName
* String 如 c:\\1.txt 绝对路径
* @return boolean
*/
public static String readFile(String filePathAndName) {
String fileContent ......
根据JDK5的新特性,用For循环Map,例如循环Map的Key
Java代码
for(String dataKey : paraMap.keySet()) {
System.out.println(dataKey ); &nbs ......
1,Java3D 作为sun公司较早推出的一项3d技术,是一种高度封装的api,构建在opengl和direct3d之上,可以说是最有名的java的3d技术。由于种种原因(api设计,面向的用户不明确),java3d一直没有办法流行,不久前java3d的团队宣布暂停对java3d新功能的开发,转而为JavaFX开发3d 渲染引擎。同时sun的另一个项目 project wonder ......