谁能详细地给我讲解一下这个程序public class MoneyDemo {private final String[] str1 = {"元","拾","佰","仟","万","拾","佰","仟","亿"};private final String[] str2 = {"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};pri

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/25 04:08:30
谁能详细地给我讲解一下这个程序public class MoneyDemo {private final String[] str1 = {
xVn@!+GMm4aX ]8$XuǖPH(<E-B@ R1ĉ؉I bb&{}qRS[q9Ò>n7/N~Y_skv2T4e[񢆖uCY-r Ut2"2DF1X"Z sF7t7chVe=y l0;_)ڮ;%6}nyL:Ow*kgKEDՀBjp0:p(.:V Ӓ-YҔy(+@e#oYa50ƈ(&dR$F̩8$F\6,=[y`/T;,h}?k<-%Y-+CfNuz`˛r]+dHQ3&z(-]vB. dfw9ܰyx[׹"41>f5M2A9UΧ-EN38]I'/C_k7S#RC^$ivt~'߮4N1D(|3 F4L8A?( x]+!lWV!9SU~djm8O/:pޮUAE1&4Pn)=%+WpWz90ECHa>c,q^P(SG|P=dT?:h򗈅u01,8WI(nIݮekE~yTim֠+t$aH/W%t 3˺<\)0 8RfiDAp:yBv }xgYQlCf]HeR ."ai):*mƋ hr@l|0az'ȓkIF gꖓ@!)pM-E4wf!%mS\ ω L 3Y̐ l [n@)e2CN

谁能详细地给我讲解一下这个程序public class MoneyDemo {private final String[] str1 = {"元","拾","佰","仟","万","拾","佰","仟","亿"};private final String[] str2 = {"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};pri
谁能详细地给我讲解一下这个程序
public class MoneyDemo {
private final String[] str1 = {"元","拾","佰","仟","万","拾","佰","仟","亿"};
private final String[] str2 = {"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
private final String[] str3 = {"角","分"};
public static void main(String[] args){
double n = 1102001.52;
String str = new MoneyDemo().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;
//1234
boolean flag=true;
for(int i=0; i

谁能详细地给我讲解一下这个程序public class MoneyDemo {private final String[] str1 = {"元","拾","佰","仟","万","拾","佰","仟","亿"};private final String[] str2 = {"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};pri
public class MoneyDemo {
\x05private final String[] str1 = { "元","拾","佰","仟","万","拾","佰","仟","亿" };
\x05private final String[] str2 = { "零","壹","贰","叁","肆","伍","陆","柒",
\x05\x05\x05"捌","玖" };
\x05private final String[] str3 = { "角","分" };
\x05public static void main(String[] args) {
\x05\x05double n = 1102001.52;
\x05\x05String str = new MoneyDemo().convert(n);
\x05\x05System.out.println(str);
\x05}
\x05public String convert(double n) {
\x05\x05String str = String.valueOf(n);//将 double 变量 n 转换成字符串
\x05\x05String temp1 = str.substring(0,str.indexOf("."));//进行切割,temp1=1102001
\x05\x05String temp2 = str.substring(str.indexOf(".") + 1);//进行切割,temp2=52
\x05\x05int k = -1;
\x05\x05int len = -1;
\x05\x05StringBuffer sb = new StringBuffer();
\x05\x05len = temp1.length() - 1;//len=6
\x05\x05// 1234
\x05\x05boolean flag = true;
\x05\x05for (int i = 0; i < temp1.length(); i++) {
\x05\x05\x05k = Integer.parseInt(temp1.substring(i,i + 1));//得到temp1的每位数字,1、1、0、2、0、0、1
\x05\x05\x05if (k != 0) {
\x05\x05\x05\x05sb.append(str2[k]).append(str1[len - i]);//str2[k]为temp1非零数的对应的大写数字、str1[len - i]为temp1拿到对应的单位
\x05\x05\x05\x05flag = true;
\x05\x05\x05} else {
\x05\x05\x05\x05if (flag) {
\x05\x05\x05\x05\x05if (len - i == 4) {
\x05\x05\x05\x05\x05\x05sb.append(str1[4]);
\x05\x05\x05\x05\x05\x05continue;
\x05\x05\x05\x05\x05}
\x05\x05\x05\x05\x05sb.append(str2[0]);
\x05\x05\x05\x05}
\x05\x05\x05\x05flag = false;
\x05\x05\x05}
\x05\x05}
\x05\x05for (int i = 0; i < 2; i++) {
\x05\x05\x05k = Integer.parseInt(temp2.substring(i,i + 1));//拿到少于一元的数字,5、2
\x05\x05\x05sb.append(str2[k]).append(str3[i]);//得到伍角贰分
\x05\x05}
\x05\x05return sb.toString();
\x05}
}

谁能给我详细讲解一下排列与组合, 谁能给我详细讲解一下氧化还原反应? 谁能给我把《周易》详细的讲解一下 分析一下这个电路图,迷你手机充电器的.谁能把这个电路图分析一下,给详细地讲解一下工作原理,再说一下可以用作手机充电器吗? 谁能详细地给我讲解一下这个程序public class MoneyDemo {private final String[] str1 = {元,拾,佰,仟,万,拾,佰,仟,亿};private final String[] str2 = {零,壹,贰,叁,肆,伍,陆,柒,捌,玖};pri 谁能给我讲解一下 谁能给我详细地讲解一下英语形容词?(英语)包括什么时候作定语,作表语,作状语,做宾补,怎样判断它? 各位高手谁能给我详细的讲解一下PCR技术的过程 谁能具体地给我讲解一下十字相乘法 谁能详细的讲解一下这个政治图.能详细解说一下吗? 高等数学谁能给我通俗易懂的讲解一下这个定理的证明 谁能给我讲解一下这个光电转换电路图的原理啊 初物理电学伏安法测电阻谁能为我详细地讲解一下怎样用伏安法测电阻? 错了的这个题,请详细地讲解一下 现在完成时和现在完成进行时的区别是什么?谁能给我详细讲解一下,最好要有实例. 谁能给我讲解一下基础、地梁、底板、顶板、墙身,它们几个之间的位置关系啊? 谁能给我讲解一下卡尔曼滤波,我最近在用mpu6050,把陀螺仪和加速度的值通过卡尔曼滤波融合.求C程序! 谁能给我讲解一下西班牙语的 中性词?