求大神解读下下面程序每一段意思 ,
来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/08/15 12:33:37
求大神解读下下面程序每一段意思 ,
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 = {"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
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
![求大神解读下下面程序每一段意思 ,](/uploads/image/z/3009822-6-2.jpg?t=%E6%B1%82%E5%A4%A7%E7%A5%9E%E8%A7%A3%E8%AF%BB%E4%B8%8B%E4%B8%8B%E9%9D%A2%E7%A8%8B%E5%BA%8F%E6%AF%8F%E4%B8%80%E6%AE%B5%E6%84%8F%E6%80%9D+%2C)
就是将数字转化成中文大写的写法