列车时刻查询及售票系统Word格式文档下载.docx

上传人:b****6 文档编号:21169682 上传时间:2023-01-28 格式:DOCX 页数:18 大小:45.93KB
下载 相关 举报
列车时刻查询及售票系统Word格式文档下载.docx_第1页
第1页 / 共18页
列车时刻查询及售票系统Word格式文档下载.docx_第2页
第2页 / 共18页
列车时刻查询及售票系统Word格式文档下载.docx_第3页
第3页 / 共18页
列车时刻查询及售票系统Word格式文档下载.docx_第4页
第4页 / 共18页
列车时刻查询及售票系统Word格式文档下载.docx_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

列车时刻查询及售票系统Word格式文档下载.docx

《列车时刻查询及售票系统Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《列车时刻查询及售票系统Word格式文档下载.docx(18页珍藏版)》请在冰豆网上搜索。

列车时刻查询及售票系统Word格式文档下载.docx

票价

Int

4

数量

3.订票信息表

姓名

身份证号

20

联系方式

3.详细设计

1.主界面

核心代码:

.*;

import

publicclassMenu{

publicstaticvoidmain(Stringargs[])

{

newEmp();

}

}

classEmpextendsJFrameimplementsActionListener{

privatestaticfinallongserialVersionUID=1L;

JButtonb1,b2,b3,b4,b5;

Emp()

super("

列车售票系统"

);

b1=newJButton("

系统用户管理"

b2=newJButton("

票务查询"

b3=newJButton("

订票"

b4=newJButton("

退票"

b5=newJButton("

退出系统"

setLayout(newGridLayout(5,1));

add(b1);

add(b2);

add(b3);

add(b4);

add(b5);

(this);

addWindowListener(newwinX());

setLocation(550,200);

setSize(240,320);

setVisible(true);

publicvoidactionPerformed(ActionEvente)

if()==b1)

{

dispose();

newxtgl();

}

if()==b2)

dispose();

newpwcx();

if()==b3)

{

newdp();

if()==b4)

newtp();

if()==b5)

(0);

2.查询

核心代码:

classcccxextendsJFrameimplementsActionListener{

JLabellab1;

JButtonb1,b2;

JTextFieldinput;

Connectioncon;

Statementstmt;

ResultSetrs;

Stringsql;

JPanelp1,p2,p3;

JTextAreaa1;

cccx(){

车次查询"

p1=newJPanel();

p2=newJPanel();

p3=newJPanel();

lab1=newJLabel("

车次:

"

(lab1);

input=newJTextField(10);

(input);

查询"

返回"

(b1);

(b2);

a1=newJTextArea();

(false);

(a1);

setLayout(newBorderLayout());

add(p1,;

add(p2,;

add(p3,;

setLocation(400,200);

setSize(600,200);

publicvoidactionPerformed(ActionEvente){

if()==b2){

newpwcx();

if()==b1){

try{

con=(,"

sa"

"

1234"

stmt=();

rs=("

select车票信息表.车次,车种,始发站,终点站,发时,到时,座位类型,票价,数量from列车信息总表,车票信息表where列车信息总表.车次=车票信息表.车次AND车票信息表.车次='

+()+"

'

if(!

())

{

("

没有任何列车信息"

}

else

车次车种始发站终点站发时到时座位类型票价数量\n"

车次"

)+("

车种"

始发站"

)+"

+("

终点站"

发时"

到时"

座位类型"

票价"

数量"

\n"

while())

("

}catch(SQLExceptione1){

(null,"

数据库连接错误!

};

3.修改

classxgcpextendsJFrameimplementsActionListener{

JLabellab1,lab2,lab3,lab4,lab5;

JTextFieldt1,t2,t3;

PreparedStatementps,ps1;

Stringa="

;

JScrollPaneg1;

Choicex1;

xgcp()

修改车票信息"

g1=newJScrollPane(a1);

lab2=newJLabel();

lab3=newJLabel("

车次座位类型票价数量"

lab4=newJLabel("

lab5=newJLabel("

t1=newJTextField(10);

t2=newJTextField(10);

t3=newJTextField(10);

修改"

x1=newChoice();

("

软卧"

("

硬座"

(t1);

(x1);

(lab4);

(t2);

(lab5);

(t3);

(b2);

(lab2);

(g1);

(lab3);

(newBorderLayout());

(lab3,;

(g1,;

try

stmt=();

rs=("

SELECT*FROM车票信息表"

if(!

{

没有车票信息!

}

else

while())

("

}catch(SQLExceptione1){

};

setLocation(400,150);

setSize(600,400);

if()==b2)

newgl1();

if().equals(a))

车次不能为空!

elsetry

SELECT车次FROM车票信息表WHERE车次='

(null,"

rs=("

SELECT车次FROM订票信息表WHERE车次='

AND座位类型='

if())

(null,"

已有人预定了该票,无法修改!

else

{

ps1=("

UPDATE车票信息表SET票价="

+())+"

数量="

WHERE车次='

();

车票信息已修改!

}

数据库连接有误!

try

4.统计

publicclasstjextendsJFrameimplementsActionListener{

JLabellab;

JPanelp1,p2;

tj()

总计信息"

lab=newJLabel("

车次车种始发站终点站发时到时座位类型票价数量"

(lab);

(lab,;

try{

con=(,"

select列车信息总表.车次,车种,始发站,终点站,发时,到时,座位类型,票价,数量from列车信息总表,车票信息表where列车信息总表.车次=车票信息表.车次"

(null,"

setSize(800,600);

setLocation(300,100);

newgl();

5.删除

classsccpextendsJFrameimplementsActionListener{

JLabellab1,lab2,lab3;

JTextFieldt1;

sccp()

删除车票信息"

删除"

(b1);

setSize(450,500);

已有人预定了该票,无法删除!

DELETEFROM车票信息表WHERE车次='

车票信息已删除!

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 经济市场

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1