java简单影院订票系统Word版_第1页
java简单影院订票系统Word版_第2页
java简单影院订票系统Word版_第3页
java简单影院订票系统Word版_第4页
java简单影院订票系统Word版_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、传播优秀word版文档 ,希望对您有帮助,可双击去除!本程序是本人在初学了半个月写的,水平有限,代码也相对简单,很多地方还有改进之处package com.j2se.simple;import java.util.scanner;public class bookticket /主界面类movie movie = new movie3;loginreg loginreg = new loginreg();scanner input = new scanner(system.in);void interface()/ 订票界面system.out.println("ttt")

2、;system.out.println("ttt 订 票 系 统");system.out.println("ttt");system.out.println("-");system.out.println("电影编号tt电影名tt上映时间tt电影票价");system.out.println(movie0.number + "tt" + movie0.moviename + "tt"+ movie0.movietime + "t" + "$&q

3、uot; + movie0.movieprice);system.out.println(movie1.number + "tt" + movie1.moviename + "tt"+ movie1.movietime + "t" + "$" + movie1.movieprice);system.out.println(movie2.number + "tt" + movie2.moviename + "tt"+ movie2.movietime + "t&quo

4、t; + "$" + movie2.movieprice);system.out.println("-");传播优秀word版文档 ,希望对您有帮助,可双击去除!void movieinformation()/ 内部电影信息movie0 = new movie();movie0.number = "s1124"movie0.moviename = "乱世佳人"movie0.movietime = "2013.11.24"movie0.movieprice = 70;movie1 = new mo

5、vie();movie1.number = "s1125"movie1.moviename = "青春如期"movie1.movietime = "2013.11.25"movie1.movieprice = 80;movie2 = new movie();movie2.number = "s1126"movie2.moviename = "让子弹飞"movie2.movietime = "2013.11.26"movie2.movieprice = 90;void book

6、ing()/ 订票boolean con = true;int index = 0;int flag = -1, -1, -1 ;do system.out.println("tt欢迎订票");system.out.println("请输入电影编号(注意字母大写)");string odd = input.next();for (int i = 0; i < movie.length; i+) if (moviei.number.equals(odd) flagindex = i;break;if (flagindex = -1) system.o

7、ut.println("tt编号输入错误(找不到您要的电影)"); else system.out.println("tt订票成功");system.out.println("电影编号t电影名tt上映时间tt电影票价");system.out.println(movieflagindex.number + "tt"传播优秀word版文档 ,希望对您有帮助,可双击去除!+ movieflagindex.moviename + "t"+ movieflagindex.movietime + &quo

8、t;tt" + "$"+ movieflagindex.movieprice);index+;system.out.println("是否需要继续订票(y/n)");string yesno = input.next();if (yesno.equals("n")con = false;if (index >= 3) system.out.println("已经没有可预订的票");con = false; while (con);int add = 0;int sign = 0;for (index

9、 = 0; index < 3; index+) if (flagindex != -1) add += movieflagindex.movieprice;sign+;system.out.println("你一共订了" + sign + "张票" + "一共¥" + add + "元");void login()/ 登陆、注册system.out.println("1.登陆tt2.注册");scanner input = new scanner(system.in);int logre

10、g = input.nextint();switch (logreg) case 1:if (loginreg.login() = 0)login();break;case 2:loginreg.reg();login();break;default:system.out.println("输入错误");login();传播优秀word版文档 ,希望对您有帮助,可双击去除!void init() movieinformation();/ 电影信息录入interface();/ 界面login();/ 用户登陆、注册booking();/ 订票package com.j2se

11、.simple;import java.util.scanner;public class loginreg /登陆,注册类finalint init = 1024;user user = new userinit;scanner input = new scanner(system.in);void reg()/用户注册int flag = 0;传播优秀word版文档 ,希望对您有帮助,可双击去除!system.out.println("t欢 迎 注 册");system.out.println("用户名");for(int i = 0;i <

12、init;i+)if(useri=null)useri = new user(); = input.next();flag = i;break;system.out.println("密码");userflag.password = input.next(); system.out.println("t恭 喜 您!注 册 成 功");int login()/用户登陆int flag = 0;system.out.println("t欢 迎 登 陆");system.out.println("用户名&quo

13、t;);string n1 = input.next();system.out.println("密码");string n2 = input.next();for(int i = 0;i < init;i+)if(useri!=null)if(.equals(n1) && useri.password.equals(n2)flag = 1;break;switch(flag)case 0:system.out.println("登陆失败");system.out.println("是否重新登录(y/n

14、)");string instr = input.next();if(instr.equals("y")login();传播优秀word版文档 ,希望对您有帮助,可双击去除!break;case 1:system.out.println("登陆成功");break;return flag;package com.j2se.simple;public class movie /电影类string number;string moviename;string movietime;int movieprice;package com.j2se.simple;public class user /用户类s

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论