Java汽车售票系统管理
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
汽车售票系统设计
1 引言
对课程设计内容做综述,介绍课程设计的目的和要求等内容,并说明采用什么开发工具设计实现一个什么系统等。
实习目的:通过汽车售票系统设计课程设计实习过程,进一步巩固《Java程序设计》课程所学的理论知识,增强学生利用所学内容获取相关知识,以解决实习过程中所面临的问题友好人机界面的布局设置,数据库的连接,Java访问修改数据库, 实现公路汽车售票系统的设计等功能和连接数据库,利用Java访问数据库,以提高利用Java语言实际动手进行程序设计的能力。上
实习要求:能够熟练运用Java,独立设计和编制一个具有一定难度的、解决实际应用问题公路汽车售票系统的设计,包括售票,退票,改签和余票查询等功能
2 系统设计
(1)需求分析
公路汽车售票系统的设计,包括售票,退票,改签和余票查询等功能;
友好人机界面
(2)总体设计方案
1).系统功能结构图
2).各子功能的主要算法流程图
余票查询和售票:
退票:
改签:
数据库的设计: 票务数据库:
用户消息数据库:
是否有售票
改签
不改签
是否有售票
退票
不退票
是否有售票
退票
不退票
是否有票
售票
不售票
3 系统实现
登陆界面:
public class Login extends JFrame implements ActionListener{
private JPanel jp =new JPanel();
private JLabel[] jlArray={
new JLabel ("用户名"),new JLabel ("密码"),new JLabel ("") };
private JButton[] jbArray={
new JButton ("登陆"),new JButton ("取消")
};
private JTextField jtxt =new JTextField("小明");
private JPasswordField jpassword = new JPasswordField("numberl");
String sql;
public Login(){
jp.setLayout(null);
for(int i =0;i<2;i++){
jlArray[i].setBounds(30,20+i*50,80,25);
jp.add(jlArray[i]);
}
for(int i =0;i<2;i++){
jbArray[i].setBounds(40+i*120,130,100,25);
jp.add(jbArray[i]);
jbArray[i].addActionListener(this);
}
jtxt.setBounds(80,20,180,25);
jp.add(jtxt);
jtxt.addActionListener(this);
jpassword.setBounds(80,70,180,25);
jp.add(jpassword);
jpassword.setEchoChar('*');
jpassword.addActionListener(this);
jlArray[2].setBounds(10,280,300,25);
jp.add(jlArray[2]);
this.add(jp);
Image image= new ImageIcon("ico.gif").getImage();
this.setSize(330,220);
this.setIconImage(image);
this.setTitle("公路汽车售票系统");
this.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==jtxt){
jpassword.requestFocus();
}
else if(e.getSource()==jbArray[1]){
jlArray[1].setText("");
jtxt.setText("");
jpassword.setText("");
jtxt.requestFocus();
}
else if(e.getSource()==jbArray[0]){
sql="select ConName,password from consumer where
ConName="+Integer.parseInt(jtxt.getText().trim());
try{
String ConName="";
String password="";
jlArray[2].setText("恭喜您,登录成功!!!");
new UserSystem();
this.dispose();
}
catch(Exception e1){e1.printStackTrace();}
}
}
public static void main(String[] args)
{
new Login();
}
}
用户公路汽车售票管理界面: