Java 学生管理系统

Java 学生管理系统


  I’m coming!我又回来了,最近有点迷上java编程了,越编越来劲,哈哈哈哈。
  奈何本人实力有限,新知识还没学明白,这次还是只是用了类的封装。

案例

在这里插入图片描述
       嗯,流程就这样滴。

程序

测试类

class Test{
   
	public static void main(String[] args){
   
		StudentSystem ss = new StudentSystem();
		ss.menu();
	}
}

学生管理系统

class StudentSystem{
    // 学生管理系统类
	Scanner input = new Scanner(System.in);
	User[] user = new User[3];
	Student[] stu = new Student[5];
	//Clazz[] clazz = new Clazz[2]
	int count;  // 计数有效用户个数
	int post;   // 存储成功登录用户下标
	int countStu;  //计数有效学生个数
	
	public StudentSystem(){
   }
	
	public void init(){
     //初始化
		user[0] = new User("202001","123456","110");
		user[1]	= new User("202002","123123","111");
		user[2]	= new User("202003","123321","112");
		count = 3;
		stu[0] = new Student("200101","123456","金子",'女',22,88.8,"2020-01");
		stu[1] = new Student("200102","123456","叶子",'男',23,66.6,"2020-01");
		stu[2] = new Student("200103","123456","二傻",'女',22,55.5,"2020-01");
		stu[3] = new Student("200201","123456","小黑",'男',22,77.7,"2020-02");
		stu[4] = new Student("200202","123456","小白",'女',23,80.0,"2020-02");
		countStu = 5;		 
	}
	
	public void menu(){
     // 主菜单(登陆界面)
		int select;  //选择键
		
		this.init();  // 初始化
		
		do{
   
			System.out.println("--------欢迎使用学生管理系统--------");
			System.out.println("1.注册         2.登录         3.退出");
			System.out.print("请输入您的操作选项: ");
			select = input.nextInt();
			switch(select){
   
				case 1 : this.register();break;
				case 2 : this.login();break;
				case 3 : System.out.println("    已退出,期待您的下次使用!");break;
				default : System.out.println("    输入有误,请重新输入\n");
			}
		}while(select != 3);
	}
	
	public void register(){
     // 注册 
		System.out.println("\n---------注册---------");
		System.out.print("请设置账号:");
		String id = input.next();
		boolean mark = true;
		for(int i=0;i<user.length;i++){
   
			if(user[i].getId().equals(id)){
   
				System.out.println("    账号已存在,请更换!");
				mark = false;
				return;
			
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值