Current location - Quotes Website - Personality signature - It is urgent. Java interview questions
It is urgent. Java interview questions
Public? Class? FormatAmt? {

Public? String? Amount (int? Dollars? int? Cents)

String? The result? =? "";

int? T dollars? =? Dollar;

And (t_dollar? & gt=? 0){

String? Temporary workers? =? String.valueOf(t_dollar? %? 1000);

If (t_dollar? & gt=? 1000){

The result? =? "000". substring (temp.length ())? +? Temporary workers? +? Results;

The result? =? ","? +? Results;

}

Otherwise {

The result? =? Temporary workers? +? Results;

The result? =? "$"? +? Results;

}

T dollars? /=? 1000;

If (t_dollar? ==? 0){

Break;

}

}

The result? +=? Cents? & gt? 10"."? +? Cents? :? ".0"? +? Cents;

Return? Results;

}

Public? Static electricity Invalid? main(String[]? args)? {

System.out.println (new? FormatAmt()。 Amount (123456,? 0));

System.out.println (new? FormatAmt()。 Amount (4973432 1,? 9));

System.out.println (new? FormatAmt()。 Amount (0,? 99));

System.out.println (new? FormatAmt()。 Amount (249,? 30));

System.out.println (new? FormatAmt()。 Amount (1000,? 1));

}

}