欢迎来到天天文库
浏览记录
ID:31631270
大小:65.55 KB
页数:5页
时间:2019-01-16
《java超市收银系统》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、packagesoftware;importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;classshangpin{StringSid;StringSmane;intjiage;publicshangpin(Stringa,Stringbjntc){Sld=a;Smane二b;jiage=c;}}classhuiyuan{StringHid;StringHname;publichuiyuan(Stringa,Stringb){Hld=a;Hname=b;}}publicclasschaoshiex
2、tendsJFrame{staticintkey=0;〃会员staticintsuml=0;//总消费staticintsum2=0;〃当天合计staticinthuiyuansum=O;〃会员人数staticintSpinsuml=O;//商品1合计staticintSpinsum2=0;//商品2合计staticintSpinsum3=0;//商品3合计staticintSpinsum4=0;//商品4合计staticintSpinsum5=0;//商品5合计publicstaticvoidmain(String[]agrs){JFrameframe二ne
3、wJFrame("超市”);frame.setSize(400,250);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);Containerc=frame.getContentPane();c.add(pan());frame.setVisible(true);}staticJPanelpan(){JPanelpanel二newJPanel();JPanelpartl=newJPanel();parti.add(newJLabel("会员卡号:"));finalJTextFieldtextl=newJT
4、extField();textl.setHorizontalAlignment(JTextField.RIGHT);textl.setColumns(ll);JButtonbuttonl=newJButton("确定”);parti.add(textl);parti.add(buttonl);partl.setVisible(true);finalJLabelJLabelOO=newJLabel("非会员”);parti.add(JLabelOO);panel.add(partl);JPanelpart2=newJPanel();part2.add(newJL
5、abel(H商品代号:"));finalJTextFieldtext2=newJTextField();text2.setHorizontalAlignment(JTextField.RIGHT);text2.setColumns(15);JButtonbutton2=newJButton(H确定");part2.add(text2);part2.add(button2);panel.add(part2);H);"));panel.add(part3);JPanelpart3=newJPanel();final儿abelJLabelO=new儿abel("fi
6、nal儿abel儿abell=new儿abel("000");finalJLabel儿abel2=newJLabel("OOOO");part3.add(newJLabel("商品名"));part3.add(JLabelO);part3.add(newJLabel("商品价格"));part3.add(JLabell);part3.add(new儿abel("元”));part3.add(newJLabel("总价格”));part3.add(JLabel2);part3.add(newJLabel("元”));part3.add(newJLabel("JP
7、anelpart4=newJPanel();JButtonbutton3=newJButton("结账”);JButtonbutton4=newJButton("总汇'*);part4.add(button3);part4.add(newJLabelf'"));part4.add(button4);panel.add(part4);buttonl.addActionListener(newActionListener(){huiyuanhuiyuanl=newhuiyuan(H00001,7,会员甲“);huiyuanhuiyuan2=newhuiyuan('
8、,00002,7,会员乙");huiy
此文档下载收益归作者所有