SMS.java 学生管理系统

时间:2017-10-15 05:29:02
【文件属性】:

文件名称:SMS.java 学生管理系统

文件大小:6KB

文件格式:JAVA

更新时间:2017-10-15 05:29:02

学生管理系统

package com hmm test820; import java util Scanner; public class SMS { public SMS { } public Student[] stu new Student[10]; public void add Student[] stu Student s { System out println "增加一个学生 " ; System out println Student count ; Student count++; this stu[Student count 1] s; } 删除操作 public void delete Student[] stu String id { int index 0; for int i 0;i<Student count;i++ { if id equals stu[i] id { index i; } } Student count ; System out println Student count ; for int i index;i<Student count;i++ { stu[i] stu[i+1]; } } 修改学生信息 public void update Student[]stu String id String name String age String job { System out println "修改学生信息 " ; for int i 0;i<Student count;i++ { if id equals stu[i] id { this stu[i] name name; this stu[i] age age; this stu[i] job job; } } } 查看单个学生信息 public void query Student[]stu String id { System out println "查看单个学生信息 " ; for int i 0;i<Student count;i++ { if id equals stu[i] id { System out println stu[i] id+" t t"+stu[i] name+" t t"+stu[i] age+" t t"+stu[i] job ; } } } 查看学生信息 public void display Student[]stu { for int i 0;i<Student count;i++ { System out print stu[i] id+" t t"+stu[i] name+" t t"+stu[i] age+" t t"+stu[i] job ; System out println ; } } 界面显示部分 登录界面首页显示 public static void print1 { System out println " n n t t欢迎使用学生信息管理系统2 0版 n" ; System out println " n n" ; System out println " t t t t1 登录系统 n n" ; System out println " t t t t2 退出 n n" ; System out println " n n" ; System out print "请选择 请输入数字:" ; } 成功登录后显示部分 public static void print2 { System out println "欢迎使用学生信息管理系统2 0版" ; System out println " " ; System out println " t t t t1 查看当前学生信息" ; System out println " t t t t2 添加学生信息" ; System out println " t t t t3 修改学生信息" ; System out println " t t t t4 查询学生信息" ; System out println " t t t t5 删除学生信息" ; System out println " t t t t6 退出" ; System out println " " ; } public static void printmessage { System out println "请输入学号 姓名 年龄 职位:" ; } public static void printid { System out println "请输入学号:" ; } public static void printnext { System out print "请继续选择您的操作(输入0返回上一菜单):" ; } public static void printlogin { System out print "请输入登录账号:" ; } public static void printps { System out print "请输入密码:" ; } public static String message { Scanner s new Scanner System in ; String str s next ; return str; } public static void printerror { System out println "input error" ; } public static int inputcount { Scanner s new Scanner System in ; int count s nextInt ; return count; } public static void main String[] args { SMS sms new SMS ; Student s new Student "001" "23" "32" "323" ; boolean flag1 true; while flag1 { print1 ; switch inputcount { case 1: { Student s new Student ; printlogin ; String login message ; printps ; String pw message ; print2 ; if login equals "login" &&pw equals "1" { print2 ; printnext ; boolean flag2 true; while flag2 { switch inputcount { case 1: { sms display sms stu ; printnext ; break; } case 2: { printmessage ; s id message ; s name message ; s age message ; s job message ; s new Student s id s name s age s job ; sms add sms stu s ; printnext ; break; } case 3: { printmessage ; s id message ; s name message ; s age message ; s job message ; s new Student s id s name s age s job ; sms update sms stu s id s name s age s job ; printnext ; break; } case 4: { printid ; s id message ; sms query Student[]stu String id ; printnext ; break; } case 5: { printid ; s id message ; sms delete sms stu s id ; printnext ; break; } case 6: { flag1 false; break; } default: { printerror ; break; } } } } break; } case 2: flag1 false; break; default: printerror ; break; } } } }">package com hmm test820; import java util Scanner; public class SMS { public SMS { } public Student[] stu new Student[10]; public void add Student[] stu Student s { System out println "增加一个学生 " ; System out println Student count ; Student count++; t [更多]


网友评论