用j**a做个人民币大小写转换器

繁三岁彡 2024-05-19 06:43:57
最佳回答
import j**a.awt.*; import j**ax.swing.*; import j**a.awt.event.*; public class gui extends jpanel{ private jtextfield intextfield=new jtextfield(20); private jtextfield outtextfield=new jtextfield(50); private timer timer=new timer(100,new timerl**tener()); private changer changer=new changer();//转换器// public gui(){ jpanel p1=new jpanel(); p1.add(new jlabel("小写")); p1.add(intextfield); p1.add(new jlabel("大写")); p1.add(outtextfield); setlayout(new borderlayout()); add(p1,borderlayout.center); outtextfield.seteditable(false); intextfield.addactionl**tener(new actionl**tener(){ public void actionperformed(actionevent e){ timer.stop(); changer.setin(intextfield.gettext()); outtextfield.settext(changer.change()); timer.start(); } }); timer.start(); } class timerl**tener implements actionl**tener{ public void actionperformed(actionevent e){ if(!intextfield.gettext().equals("")){ changer.setin(intextfield.gettext()); outtextfield.settext(changer.change()); } } } public static void main(string[] args){ jframe frame=new jframe(); gui gui=new gui(); frame.getcontentpane().add(gui); frame.setv**ible(true); frame.setdefaultcloseoperation(jframe.exit_on_close); frame.pack(); } static class changer{ string in; string out=""; public changer(){ } public changer(string in){ th**.in=in; } public void setin(string in){ th**.in=in; } public string change(){ int lengthofp1=(in.indexof(".")!=-1) ? in.indexof(".") : in.length(); //整数部分//; int lengthofp2=(in.indexof(".")!=-1) ? in.length()-lengthofp1-1 : in.length()-lengthofp1 ; //小数部分//; if(lengthofp2>2){ in=in.substring(0,in.indexof(".")+3); } //取两位小数// int p1=0; int p2=0; if(in.indexof(".")!=-1&&in.indexof(".")!=in.length()-1){ p1=integer.parseint(in.substring(0,in.indexof("."))); p2=integer.parseint(in.substring(in.indexof(".")+1,in.length())); //取两位小数// } else if(in.indexof(".")==in.length()-1){ p1=integer.parseint(in.substring(0,in.indexof("."))); } else{ p1=integer.parseint(in); } if(p2<10&&lengthofp2==1){ p2=p2*10; } //取两位数// if(lengthofp1>=10){ return "too much money."; } for(int i=lengthofp1;i>0;i--){ int temp=(p1/((int)math.pow(10,i-1))); out+=value3(temp)+value1(i); p1=p1%(int)math.pow(10,i-1); } for(int i=2;i>0;i--){ int temp=(p2/((int)math.pow(10,i-1))); out+=value3(temp)+value2(i); p2=p2%(int)math.pow(10,i-1); } string output=out; out=""; return output; } public static string value1(int num){ switch(num){ case 1: return "元"; case 2: return "十"; case 3: return "百"; case 4: return "千"; case 5: return "万"; case 6: return "十万"; case 7: return "百万"; case 8: return "千万"; case 9: return "亿"; default: return **; } }//转为中文符号// public static string value2(int num){ switch(num){ case 2: return "角"; case 1: return "分"; default: return **; } }//转为中文符号// public static string value3(int num){ string s="零壹贰叁肆伍陆柒捌玖"; return s.charat(num)+""; }//转大写// } } 20210311
汇率兑换计算器

类似问答
  • 人民币大写怎么用
    • 2024-05-19 14:42:55
    • 提问者: 未知
    1到各大安卓市场下载并安装应用1本页面非法爬取自百度经验2打开应用3输入要转换的人民币小写金额点转换4这里注意 如果不输入人民币小写金额点转换 会提示你 请输入人民币小写金额5如果输入的人民币小写金额大于1000亿 会提示你 金额过大,应小于1000亿元!6点转换后会显示对应的人民币大写,点复制按钮,则结果会被复制到系统剪切板中7在要放置的位置,点粘贴即可将复制的结果粘贴上去end
  • 怎么在线转换人民币的大小写
    • 2024-05-19 03:07:42
    • 提问者: 未知
    1首先直接打开百度网,在其输入框中输入人民币大写转。2然后再搜索网页结果中,随意点个软件进去,就可以转换了。end
  • 人民币小写和大写怎么写?
    • 2024-05-19 19:03:24
    • 提问者: 未知
    合计人民币 万 仟 佰 拾 元 角分整 人民币符号和**伯数字(我找不到人民币符号所以用文字代替)
  • 人民币金额小写转大写
    • 2024-05-19 14:57:18
    • 提问者: 未知
    1方法一:在单元格中输入=substitute(substitute(text(int(a2),"[dbnum2][$-804]g/通用格式元"&if(int(a2)=a1,"整",""))&text(mid(a2,find(".",a2&".0")+1,1),"[dbnum2][$-80...
  • 3840台币转换人民币
    • 2024-05-19 07:33:05
    • 提问者: 未知
    1人民币元=4.9743**3840**=771.84人民币元
  • 100秘币转换人民币
    • 2024-05-19 19:30:55
    • 提问者: 未知
    人民币目前还未开展与秘币的兑换业务。
  • 小写金额人民币10.239.85写成大写金额人民币怎么写?
    • 2024-05-19 19:05:16
    • 提问者: 未知
    10239.85是:壹万零贰佰叁拾玖元捌角伍分
  • 4.25荷兰币转换成人民币是多小钱?
    • 2024-05-19 01:52:05
    • 提问者: 未知
    荷兰目前使用的是欧元,按最新汇率货币兑换,1欧元=7.3888人民币元,4.25欧元=31.3595人民币元。
  • excel人民币大写转换函数
    • 2024-05-19 08:56:02
    • 提问者: 未知
    11.启动excel,按alt+f11组合键打开vba编辑窗口,并插入一个新模块。22.在《模块1》的编辑窗口中填写如下代码:public function rmbdx(m)'人民币大写函数 rmbdx = replace(application.text(round(m + 0.00000001, 2), "[dbnum2]"), ".", ...
  • excel中人民币大写怎么转换
    • 2024-05-19 09:15:21
    • 提问者: 未知
    1可以选用公式法,a2处输入小写金额2在b2单元格中输入如下公式,=if(a2=0,"",if(a2<0,"负","")&substitute(substitute(substitute(substitute(text(int(abs(a2)),"[dbnum2]")&"元"&text(rig...
汇率兑换计算器

热门推荐
热门问答
最新问答
推荐问答
新手帮助
常见问题
房贷计算器-九子财经 | 备案号: 桂ICP备19010581号-1 商务联系 企鹅:2790-680461

特别声明:本网为公益网站,人人都可发布,所有内容为会员自行上传发布",本站不承担任何法律责任,如内容有该作者著作权或违规内容,请联系我们清空删除。