求大神解读下下面程序每一段意思 ,public class MoneyConvert { private final String[] str1 = {"元","拾","佰","仟","万","拾","佰","仟","亿"}; private final String[] str2 = {"零","壹","贰","叁","肆","伍","陆","柒","捌","
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 11:27:29
求大神解读下下面程序每一段意思 ,public class MoneyConvert { private final String[] str1 = {"元","拾","佰","仟","万","拾","佰","仟","亿"}; private final String[] str2 = {"零","壹","贰","叁","肆","伍","陆","柒","捌","
求大神解读下下面程序每一段意思 ,
public class MoneyConvert
{
private final String[] str1 = {"元","拾","佰","仟","万","拾","佰","仟","亿"};
private final String[] str2 = {"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
private final String[] str3 = {"角","分"};
public static void main(String[] args)
{
double n = 1234506.789;
MoneyConvert mc = new MoneyConvert();
String str = mc.convert(n);
System.out.println(str);
}
public String convert(double n)
{
String str = String.valueOf(n);
String temp1 = str.substring(0,str.indexOf("."));
String temp2 = str.substring(str.indexOf(".")+1);
int k = -1;
int len = -1;
StringBuffer sb = new StringBuffer();
len = temp1.length()-1;
for(int i=0; i
求大神解读下下面程序每一段意思 ,public class MoneyConvert { private final String[] str1 = {"元","拾","佰","仟","万","拾","佰","仟","亿"}; private final String[] str2 = {"零","壹","贰","叁","肆","伍","陆","柒","捌","
就是将数字转化成中文大写的写法