首页 热点资讯 义务教育 高等教育 出国留学 考研考公
您的当前位置:首页正文

公交报站系统

2024-12-15 来源:华佗小知识

效果如下

Paste_Image.png
public class Baozhan {
    public static void main(String[] args) {
        String[] point = { "西流湖站", "西三环站", "秦岭路站", "桐柏路", "碧沙岗", "医学院", "火车站",
                "二七广场", "人民路站", "紫荆山", "燕庄", "黄河路站", "农业路站", "东风南路站", "郑州东站",
                "市体育中心" };
        System.out.println("          欢迎乘坐城市轨道交通1号线");
        System.out.print("请输入当前站点");
        Scanner s = new Scanner(System.in);
        while (true) {
            int t = s.nextInt();
            switch (t) {
            case 1:
                System.out.println("当前站点:" + point[0] + "    下一站:" + point[1]);
                break;
            case 2:
                System.out.println("当前站点:" + point[1] + "    下一站:" + point[2]);
                break;
            case 3:
                System.out.println("当前站点:" + point[2] + "    下一站:" + point[3]);
                break;
            case 4:
                System.out.println("当前站点:" + point[3] + "    下一站:" + point[4]);
                break;
            case 5:
                System.out.println("当前站点:" + point[4] + "    下一站:" + point[5]);
                break;
            case 6:
                System.out.println("当前站点:" + point[5] + "    下一站:" + point[6]);
                break;
            case 7:
                System.out.println("当前站点:" + point[6] + "    下一站:" + point[7]);
                break;
            case 8:
                System.out.println("当前站点:" + point[7] + "    下一站:" + point[8]);
                break;
            case 9:
                System.out.println("当前站点:" + point[8] + "    下一站:" + point[9]);
                break;
            case 10:
                System.out.println("当前站点:" + point[9] + "    下一站:" + point[10]);
                break;
            case 11:
                System.out
                        .println("当前站点:" + point[10] + "    下一站:" + point[11]);
                break;
            case 12:
                System.out
                        .println("当前站点:" + point[11] + "    下一站:" + point[12]);
                break;
            case 13:
                System.out
                        .println("当前站点:" + point[12] + "    下一站:" + point[13]);
                break;
            case 14:
                System.out
                        .println("当前站点:" + point[13] + "    下一站:" + point[14]);
                break;
            case 15:
                System.out.println("当前站点:" + point[14] + "    下一站终点站"
                        + point[15]);
                break;
            case 16:
                System.out.println("当前站点:" + point[15] + "    本站为终点站");
                break;
            default:
                System.out.println("请确认有效站点");
                break;
            }
        }
    }

}
显示全文