JAVA模拟科学计算器.doc

JAVA模拟科学计算器.doc

ID:55631658

大小:99.00 KB

页数:26页

时间:2020-05-21

JAVA模拟科学计算器.doc_第1页
JAVA模拟科学计算器.doc_第2页
JAVA模拟科学计算器.doc_第3页
JAVA模拟科学计算器.doc_第4页
JAVA模拟科学计算器.doc_第5页
资源描述:

《JAVA模拟科学计算器.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;publicclassCaextendsJFrameimplementsActionListener{//***********************************************************************//标准型计算器控件键钮staticJFramef1=newJFrame("计算器");privateStringKEYS[]={"7","8","9","/","sq

2、rt","4","5","6","*","%","1","2","3","-","1/x","0","+/-",".","+","="};privateStringM[]={"","MC","MR","MS","M+"};privateStringCOM[]={"Backspace","CE","C"};privateJButtonkeys[]=newJButton[KEYS.length];privateJButtoncom[]=newJButton[COM.length];privateJButtonm[]=newJButto

3、n[M.length];privateJTextFieldresult,hh,jj;MenuBarmenubar1=newMenuBar();Menuedit=newMenu("编辑(E)"),view=newMenu("查看(V)"),help=newMenu("帮助(H)");MenuItemcopy=newMenuItem("复制(C)"),paste=newMenuItem("粘贴(P)"),standar=newMenuItem("标准型(T)"),science=newMenuItem("科学型(S)"),numgro

4、up=newMenuItem("数字分组(I)"),helpt=newMenuItem("帮助主题(H)"),about=newMenuItem("关于计算器(A)");privatebooleanfirstDigit=true;//判断第一个输入的字符是否是数字privatedoubleresultNum=0.0,resultNum2=0.0;//中间结果privateStringoperator="=",co,str,operator2="=";privatebooleanoperateValidFlag=true;//***

5、********************************************************************//科学性计算器控件及按钮staticJFramef2=newJFrame("科学计算器");privateJTextFieldresult2;privateString[]KON={"sta","F-E","(",")","MC","Ave","dms","Exp","In","MR","Sum","sin","x^y","log","MS","s","cos","x^3","n!","M+",

6、"Dat","tan","x^2","1/x","pi"};privateString[]KO={"7","8","9","/","Mod","And","4","5","6","*","Or","Xor","1","2","3","-","Lsh","Not","0","+/-",".","+","=","Int","A","B","C","D","E","F"};privateStringITM[]={"标准型","科学型","十六进制数(H)F5","十进制(D)F6","八进制(O)F7","二进制(B)F8","四字(Q

7、)F12","DWORD值(R)F2","单字(W)F3","字节(Y)F4","数字分组(I)"};privatefinalString[]COMM={"Backspace","CE","C"};privateJButtoncomm[]=newJButton[COMM.length];privateJButtonkon[]=newJButton[KON.length];privateJButtonko[]=newJButton[KO.length];privateMenuItemitm[]=newMenuItem[ITM.len

8、gth];privateJPanelpanel0,panel1,panel2,panel3,panel4,panel5,panel6;Checkboxcheckbox1,checkbox2,checkbox3,checkbox4;MenuBarme

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。