RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
Java实现学生管理系统

项目描述:通过管理员帐号登录,对学员信息进行管理。可以实现学员信息的增加、修改、删除、查询。

为三明等地区用户提供了全套网页设计制作服务,及三明网站建设行业解决方案。主营业务为成都网站设计、网站建设、三明网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

知识点:数组、do{}while循环、for循环、if语句、switch条件语句

Java实现学生管理系统

学生管理系统的流程图

import java.util.Scanner; 
public class Stu{ 
  public static void main(String[] args){ 
  Scanner sc = new Scanner(System.in); 
  boolean flag = false; 
  int stuNum = 0; 
  String[] stuName = new String[20]; 
  String[] stuId = new String[20]; 
  System.out.println("**********************************"); 
  System.out.println("*                *"); 
  System.out.println("*                *"); 
  System.out.println("* 欢迎使用德润科技教务管理系统 *"); 
  System.out.println("*                *"); 
  System.out.println("*                *"); 
  System.out.println("**********************************"); 
  System.out.println("\n"); 
  do{ 
  System.out.println("************************"); 
  System.out.println("请输入想要执行的操作"); 
  System.out.println("1.登录系统  2.退出系统"); 
  String num1 = sc.next(); 
  if(num1.equals("1")){ 
    flag = false; 
    break; 
  }if(num1.equals("2")){ 
    System.exit(0); 
    flag = false; 
  }else{ 
    System.out.println("输入有误请重新输入"); 
    flag = true; 
    } 
  }while(flag); 
  do{ 
    System.out.println("请输入登陆账号"); 
    String username = sc.next(); 
    System.out.println("请输入密码"); 
    String password = sc.next(); 
  if(username.equals("tiantian")&&password.equals("dahai")){ 
    System.out.println("欢迎"+username); 
    flag = false; 
  }else{ 
    System.out.println("账号或者密码错误,请重新登录"); 
    flag = true; 
    } 
  }while(flag); 
  do{ 
  System.out.println("********************"); 
  System.out.println("请输入想要进行的操作"); 
  System.out.println("****************************************************************************"); 
  System.out.println("1.增加学员信息 2.删除学员信息 3.修改学员姓名 4.查看学员信息 5.退出系统"); 
  System.out.println("****************************************************************************"); 
  String num2 = sc.next(); 
  switch(num2){ 
    case "1": 
      System.out.println("请输入要添加的学员姓名"); 
      stuName[stuNum] = sc.next(); 
      System.out.println("请输入要添加的学员学号"); 
      stuId[stuNum] = sc.next(); 
      stuNum++; 
      System.out.println("添加成功"); 
      flag = true; 
      break; 
    case "2": 
      System.out.println("请输入想要删除的学员的学号"); 
      String stuIdDel = sc.next(); 
      for(int i=0;i

以下为优化后的代码

import java.util.Scanner; 
public class Stu{ 
  public static void main(String[] args){ 
  Scanner sc = new Scanner(System.in); 
  boolean flag = false; 
  boolean ss = true; 
  boolean aa = true; 
  boolean bb = true; 
  boolean cc = true; 
  int stuNum = 0; 
  String[] stuName = new String[20]; 
  String[] stuId = new String[20]; 
  String[] userNames = new String[5]; 
  String[] passWords = new String[5]; 
  System.out.println("*******************************************************"); 
  System.out.println("*                           *"); 
  System.out.println("*                           *"); 
  System.out.println("*      欢迎使用德润科技教务管理系统       *"); 
  System.out.println("*                           *"); 
  System.out.println("*                           *"); 
  System.out.println("*******************************************************"); 
  System.out.println("\n"); 
  do{ 
  System.out.println("************************"); 
  if(userNames[0]==null){ 
    System.out.println("请输入想要执行的操作(你还没有登陆账号请先注册)"); 
  }else{ 
    System.out.println("请输入想要执行的操作(您已注册管理员身份,可以登录系统)"); 
    } 
  System.out.println("1.注册帐号 2.登录系统 3.忘记密码 4.退出系统"); 
  String num1 = sc.next(); 
  switch(num1){ 
  case "1": 
    do{ 
    System.out.println("请输入想要注册的用户名"); 
    userNames[stuNum] = sc.next(); 
    System.out.println("请输入想要注册的密码"); 
    String password1 = sc.next(); 
    System.out.println("请再次输入密码"); 
    String password2 = sc.next(); 
    if(password1.equals(password2)){ 
    passWords[stuNum] = password1; 
    System.out.println("恭喜!帐号:"+userNames[stuNum]+"创建成功"); 
    flag = true; 
    }else{ 
    System.out.println("两次输入的密码不一致请重新创建"); 
    flag = false; 
    } 
    }while(!flag); 
    stuNum++; 
    continue; 
  case "2": 
    flag = false; 
    break; 
  case "3": 
    System.out.println("请输入要查询密码的帐号"); 
    String username1 = sc.next(); 
    for(int i=0;i

本代码为Java初级人员编写,方法运用不是很恰当,仅供娱乐。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持创新互联。


标题名称:Java实现学生管理系统
文章网址:http://sczitong.cn/article/jhdcgc.html