简单模拟一下科目三的灯光考试

来源:互联网 发布:mysql命令行导入数据库 编辑:程序博客网 时间:2024/04/30 08:43

因为毕业的事,少学习了两周的时间,唉,本来想着今天把科目三都写完的,可是明天还有事情,就先写了一下灯光的模拟,后面的以后补上,好了,老规矩,上代码:

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() {////    }}
那个五秒钟本来想用线程的,可是想了想不行,不过现在感觉那个五秒还是有问题,下次修改,上一下测试的图片



0 0
原创粉丝点击