版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- GB/T 3102.7-2026量和单位第7部分:光和辐射
- 2025~2026学年河北省保定市涞水县人教版六年级上册11月期中数学试卷【附答案】
- 2027届四川省绵阳市游仙区数学八上期末综合测试模拟试题含解析
- PHP工程师笔试真题(含详细答案·企业实操版)
- 2026年康复治疗考试题库及答案
- 2025-2026学年浙江省嵊州市初中历史八年级期末上册模考全真模拟题详细参考解析
- 成品设备检验员安全操作规程
- 托育机构食品安全操作规程
- 2026年全国青少年禁毒知识竞赛题库及答案
- 浙江省绍兴市越城区2027届九年级数学第一学期期末检测模拟试题含解析
- 自考 08257 舆论学・重点精简版(速记 + 考点)
- 2026年校招:太平洋保险笔试题及答案
- 2026国企招聘考试公共基础知识考试题(含答案)
- 2025年银行考试-银行间本币市场交易员资格笔试考试历年典型考题及考点
- 安徽省2026年中考数学试题(解析版)
- 【万科集团财务风险防范措施研究8400字(论文)】
- 2026年度中国建设银行吉林省春季校园招聘(194人)笔试参考题库及答案解析
- 2026秋招:中国联通题库及答案
- 农业机械操作与维护规范(标准版)
- 面部大拉皮课件
- 【低空经济】低空监控平台设计方案
评论
0/150
提交评论