简单模拟一下科目三的灯光考试
2015-06-26 22:26
393 查看
因为毕业的事,少学习了两周的时间,唉,本来想着今天把科目三都写完的,可是明天还有事情,就先写了一下灯光的模拟,后面的以后补上,好了,老规矩,上代码:
package cn.edu.sjzc.fanyafeng.testlamejni.test; import java.util.Scanner; import cn.edu.sjzc.fanyafeng.testlamejni.util.S; /** * Created by 亚风 on 2015/06/26/0026. */ public class TestThreeSubjects { public static void main(String[] args) { S.pl("科目三模拟"); testLights(); } /** * 简单列举了三个灯光测试 * 1.雾天行驶 * 2.发生故障难以移动 * 3.会车 */ private static void testLights() { S.pl("下面是灯光考试,请根据提示信息在五秒内做出相应操作!"); S.pl("请输入第一个灯光考试"); //第一个灯光考试 S.pl("请打开远光灯!"); Scanner input_light_01 = new Scanner(System.in); int light_01 = input_light_01.nextInt(); switch (light_01) { case 1: S.pl("雾天行驶,请做出相应的灯光操作!"); long start_01_time = System.currentTimeMillis(); Scanner input_light_1_1 = new Scanner(System.in); int light_1_1 = input_light_1_1.nextInt(); long end_01_time = System.currentTimeMillis(); if (light_1_1 == 1 && end_01_time - start_01_time < 50000) { S.pl("操作完成"); } else { S.pl("考试不合格"); System.exit(0); } break; case 2: S.pl("发生故障难以移动,请做出相应的灯光操作!"); long start_01_2_time = System.currentTimeMillis(); Scanner input_light_1_2 = new Scanner(System.in); int light_1_2 = input_light_1_2.nextInt(); long end_01_2_time = System.currentTimeMillis(); if (light_1_2 == 2 && end_01_2_time - start_01_2_time < 50000) { S.pl("操作完成"); } else { S.pl("考试不合格"); System.exit(0); } break; case 3: S.pl("会车,请做出相应的灯光操作!"); long start_01_3_time = System.currentTimeMillis(); Scanner input_light_1_3 = new Scanner(System.in); int light_1_3 = input_light_1_3.nextInt(); long end_03_3_time = System.currentTimeMillis(); if (light_1_3 == 3 && end_03_3_time - start_01_3_time < 50000) { S.pl("操作完成"); } else { S.pl("考试不合格"); System.exit(0); } break; } S.pl("请打开远光灯!"); //第二个灯光考试 Scanner input_light_02 = new Scanner(System.in); int light_02 = input_light_02.nextInt(); switch (light_02) { case 1: S.pl("雾天行驶,请做出相应的灯光操作!"); long start_02_time = System.currentTimeMillis(); Scanner input_light_2_1 = new Scanner(System.in); int light_2_1 = input_light_2_1.nextInt(); long end_02_time = System.currentTimeMillis(); if (light_2_1 == 1 && end_02_time - start_02_time < 50000) { S.pl("操作完成"); } else { S.pl("考试不合格"); System.exit(0); } break; case 2: S.pl("发生故障难以移动,请做出相应的灯光操作!"); long start_02_2_time = System.currentTimeMillis(); Scanner input_light_2_2 = new Scanner(System.in); int light_2_2 = input_light_2_2.nextInt(); long end_02_2_time = System.currentTimeMillis(); if (light_2_2 == 1 && end_02_2_time - start_02_2_time < 50000) { S.pl("操作完成"); } else { S.pl("考试不合格"); System.exit(0); } break; case 3: S.pl("会车,请做出相应的灯光操作!"); long start_02_3_time = System.currentTimeMillis(); Scanner input_light_2_3 = new Scanner(System.in); int light_2_3 = input_light_2_3.nextInt(); long end_02_3_time = System.currentTimeMillis(); if (light_2_3 == 1 && end_02_3_time - start_02_3_time < 50000) { S.pl("操作完成"); } else { S.pl("考试不合格"); System.exit(0); } break; } //第三个灯光考试 S.pl("请打开远光灯!"); Scanner input_light_03 = new Scanner(System.in); int light_03 = input_light_03.nextInt(); switch (light_03) { case 1: S.pl("雾天行驶,请做出相应的灯光操作!"); long start_03_time = System.currentTimeMillis(); Scanner input_light_3_1 = new Scanner(System.in); int light_3_1 = input_light_3_1.nextInt(); long end_03_time = System.currentTimeMillis(); if (light_3_1 == 1 && end_03_time - start_03_time < 50000) { S.pl("操作完成"); } else { S.pl("考试不合格"); System.exit(0); } break; case 2: S.pl("发生故障难以移动,请做出相应的灯光操作!"); long start_03_2_time = System.currentTimeMillis(); Scanner input_light_3_2 = new Scanner(System.in); int light_3_2 = input_light_3_2.nextInt(); long end_03_2_time = System.currentTimeMillis(); if (light_3_2 == 2 && end_03_2_time - start_03_2_time < 50000) { S.pl("操作完成"); } else { S.pl("考试不合格"); System.exit(0); } break; case 3: S.pl("会车,请做出相应的灯光操作!"); long start_03_3_time = System.currentTimeMillis(); Scanner input_light_3_3 = new Scanner(System.in); int light_3_3 = input_light_3_3.nextInt(); long end_03_3_time = System.currentTimeMillis(); if (light_3_3 == 3 && end_03_3_time - start_03_3_time < 50000) { S.pl("操作完成"); } else { S.pl("考试不合格"); System.exit(0); } break; } S.pl("灯光考试结束,请关闭灯光"); } // private static void testStart() { // // } }那个五秒钟本来想用线程的,可是想了想不行,不过现在感觉那个五秒还是有问题,下次修改,上一下测试的图片
相关文章推荐
- Linux和Windows下控制台字体颜色设置
- 【POJ 2253】Frogger
- Java反射(四)利用反射调用方法
- Shuffle'm Up
- Java中4大基本加密算法解析
- Linux学习笔记 (四)归档和压缩
- Centos6.6 安装rsync服务端
- Java内存管理机制
- Sql入门---------汇总函数
- “吃神么,买神么”的第三个Sprint冲刺总结
- 剑指offer 47-不用加减乘除做加法 交换
- Prime Path
- 复习纲要更正
- 网信金融 与 金银猫合作
- 基于社交网络的情绪化分析II
- 看源码的一些总结
- android笔记之onMeasure方法
- IOS--OC--LessonNSString 字符串
- std::function用法
- Android开源SlidingMenu的使用