Çë¸÷λ¸ßÊÖ²»Áߴͽ̣¬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
Ïà¹ØÎĵµ£º
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 ......
ͨË×Àí½âÏòÉÏתÐÍ£º
¾ÍÊÇ×ÓÀàתÐͳɸ¸Àà¡£
class A{}
class B extends A { }
A b = new B();
Õâ¸ö¾ÍÊÇÏòÉÏתÐÍ¡£
ÏòÉÏתÐÍ¿ÉÒÔÏñÏÂÃæÕâÌõÓï¾äÕâô¼òµ¥:
Shape s =new Circle();
ÕâÀ´´½¨Ò»¸öCircle¶ÔÏ ......
¸ù¾ÝJDK5µÄÐÂÌØÐÔ,ÓÃForÑ»·Map,ÀýÈçÑ»·MapµÄKey
Java´úÂë
for(String dataKey : paraMap.keySet()) {
System.out.println(dataKey ); &nbs ......
1£ºÓÃhttpÐÒéÉÏ´«¸üÊʺÏweb±à³ÌµÄ·½±ã£»´«Ð¡ÓÚ1MÎļþËÙ¶ÈÒª±ÈÓÃftpÐÒéÉÏ´«ÎļþÂÔ¿ì¡£°²È«ÐԺ㻲»ÏñftpÄÇÑù£»±ØÐëÒªÆô¶¯Ò»¸öftp·þÎñ²ÅÐС£
2£ºÓÃftpÐÒéÉÏ´«Îļþ´óÓÚ1MµÄÎļþËٶȱÈhttp¿ì£»ÎļþÔ½´ó£»ÉÏ´«µÄËٶȾͱÈhttpÉÏ´«¿ìµÄ±¶ÊýÔ½´ó¡£¶øÇÒÓÃjava±àд³ÌÐò£»ftp±Èhttp·½±ã¡£ºÃ£¬·Ï»°ÉÙ˵£»ÎÒÃÇÏȴһ¸öʵÀýÀ´ÀíÐÔÈÏ ......