学生管理系统(残缺版)

发布于:2024-07-12 ⋅ 阅读:(163) ⋅ 点赞:(0)
package Project;

import java.util.Scanner;

public class OnlineTe {
    public static void main(String[] args) {
        for (;;){
        System.out.println("------欢迎使用OnlineT------");
        System.out.println("请输入访问的级别:");
        System.out.println("1:Stu");
        System.out.println("2:Manageer");
        System.out.println("3:Quit");
        Scanner sc =new Scanner(System.in);
        int num = sc.nextInt();
        String sna="1";
        String spw="123456";
        String mna="2";
        String mpw="123456";
        String [] Namebox =new String[10];
        String [] Pssswordbox =new String[10];
        int flag = 0;
        //StuSystem
        if (num==1){
            a:for (;;){
                System.out.println("您的身份是Stu,请(1.登录) 或( 2.创建!)");
                int chose1= sc.nextInt();
                if (chose1==1){//登录
                    for (;;){
                        for (;;){
                            for (;flag!=1;){
                            System.out.println("Name:");
                            String stuName = sc.next();
                            System.out.println("Password:");
                            String stupw = sc.next();
                            for (int i = 0; i < 10; i++) {
                                if (stuName.equals(sna)|stuName.equals(Namebox[i])){//对比用户名
                                    System.out.println("Name Right !");
                                    if (stupw.equals(spw)|stupw.equals(Pssswordbox[i])){//对比密码
                                        System.out.println("Password Right ! Login success!");//进入系统
                                        flag=1;
                                        System.out.println("Welcome to StuSystem ! Please choise your block ! ( 1.User Block )( 2.Text Block)( 3. Quit )");
                                        int chose2= sc.nextInt();
                                        if (chose2==1){//用户管理
                                            System.out.println("Please choise your Action ! ( 1.Change Password )( 2. Quit )");
                                            int chose3= sc.nextInt();
                                            if (chose3==1){
                                                System.out.println("--修改密码界面--");
                                            } else if (chose3==2) {
                                                System.out.println("Do you wanna to Qqqquit?");
                                                break;
                                            }

                                        } else if (chose2==2) {//考试管理
                                            System.out.println("Exam begins!");
                                            System.out.println("Exam over! waht do you annna do ? (1.Query grades )(2.Output grades )(3.Quit )");
                                            int chose4= sc.nextInt();
                                            if (chose4==1){//查询
                                                System.out.println("Your grade is **** !");
                                            } else if (chose4==2) {//导出
                                                System.out.println("Output success !");
                                            }else {//退出
                                                System.out.println("Do you wanna to Quit ?");
                                                break;
                                            }

                                        }else if (chose2==3){
                                            System.out.println(" you wanna to Quit ?");
                                            break a;
                                        }
                                    }else {
                                        System.out.println("Password worng ! Try again!");//再次尝试
                                    }
                                }else if (flag!=1){
                                    System.out.println("Not Right ! Try again ! ");
                                    break a;
                                }
                            }
                        }
                      }
                    }
                }
                if (chose1==2){//注册
                    b:for (;;){
                        System.out.println("Please input Name:");
                        String name1 = sc.next();
                        boolean found = false;
                        for (int i = 0; i < Namebox.length; i++) {
                            if (Namebox[i] == null) {
                                Namebox[i] = name1;
                                System.out.println("成功注册Name!");
                                found = true;
                                break;
                            } else if (Namebox[i].equals(name1)) {
                                System.out.println("Name already used!");
                                found = true;
                                break b;
                            }
                        }
                        if (!found){
                            System.out.println("所有用户名位置已满!");
                        }else {
                            System.out.println("Please input Password:");
                            String password1 = sc.next();
                            for (int n = 0; n < Pssswordbox.length; n++){
                                if (Pssswordbox[n] == null) {
                                    Pssswordbox[n] = password1;
                                    System.out.println("成功注册Password!");
                                    System.out.println("注册成功!");
                                    break b;
                                }
                            }
                        }
                    }//
              }
            }
        }
        if (num==2){
            for (;;){
            System.out.println("欢迎登陆管理员!");
            System.out.println("Name:");
            String name = sc.next();
            if (name.equals(mna)){
                System.out.println("Name Right !");
                System.out.println("Password:");
                String password = sc.next();
                if (password.equals(mpw)){
                    System.out.println("Password Right !");
                    System.out.println("管理员登陆成功!");
                    for (;;){
                    System.out.println("Waht do you annna do ? (1.管理学员 )(2.管理考题 )(3.Quit )");
                    int choise5 = sc.nextInt();
                    if (choise5==1){
                        for (;;){
                        System.out.println("---学员管理界面---");
                        System.out.println("Waht do you annna do ? (1.增加学员)(2.删除学员)(3.修改学员)(4.查找学员)(5.显示所有学员信息)(6.退出本模块)");
                        int choise6 = sc.nextInt();
                        if (choise6==1){
                            System.out.println("增加学员");
                        } else if (choise6==2) {
                            System.out.println("删除学员");
                        } else if (choise6==3) {
                            System.out.println("修改学员");
                        } else if (choise6==4) {
                            System.out.println("查找学员");
                        } else if (choise6==5) {
                            System.out.println("显示所有学员信息");
                        } else if (choise6==6) {
                            System.out.println("退出本模块");
                            break;
                        }
                    }
                    if (choise5==2){
                        System.out.println("---考题管理界面---");
                        System.out.println("Waht do you annna do ? (1.增加考题)(2.删除考题)(3.修改考题)(4.查找考题)(5.显示所有考题信息)(6.退出本模块)");
                        int choise7 = sc.nextInt();
                        if (choise7==1){
                            System.out.println("增加考题");
                        } else if (choise7==2) {
                            System.out.println("删除考题");
                        } else if (choise7==3) {
                            System.out.println("修改考题");
                        } else if (choise7==4) {
                            System.out.println("查找考题");
                        } else if (choise7==5) {
                            System.out.println("显示所有考题信息");
                        } else if (choise7==6) {
                            System.out.println("退出本模块");
                            break;
                        }
                    }
                    if (choise5==3){
                        System.out.println("退出至起始模块");
                        break ;
                      }
                    }
                }
                if (!password.equals(mpw)){
                    System.out.println("Not Right ! Try again ! ");
                    break;
                   }
                }
            }
            if (!name.equals(mna)){
                System.out.println("Not Right ! Try again ! ");
                break;
               }
            }
       }
    }
  }
}

网站公告

今日签到

点亮在社区的每一天
去签到