当前位置:首页 > java > 正文

java信息管理系统代码

  • java
  • 2024-05-26 12:55:29
  • 9353
本文目录一览

基于java控制台的学生信息管理系统开发与实现(基于java的学生管理系统的设计与实现)

打包;

importjava.io.*;

importjava.util.*;

publicclassTreemap{

staticTreeMaptm=newTreeMap();//实例化一个树对象

staticStudents;//声明一个静态变量S

publicstaticvoidmain(Stringargs[]){

try{

try{

fis=new("students.txt");//实例化一个对象,读取文件Students.txt

ois=new(fis);

while((s=(Student)(ois.readObject()))!=null)

{

tm.put(s.stunum,s);

}

ois.close();

}catch(IOExceptionioe){

}catch(c){

}

尝试{

while(true){

System.out.println("[0]主菜单[1]查找[2]输入[3]删除[4]全部列出[5]退出");//显示菜单

System.out.print("请选择进程:");

is=new(System.in);

br=new(is);

Stringch=br.readLine();

intc=Integer.parseInt(ch);

switch(c){

case0:

break;

case1:

search();

break;

case2:

input();

break;

case3:

delete();

break;

情况4:

listAll();

break;

情况5:

tm.clear();

System.exit(0);

break;

默认:

System.out.println("输入错误!");

}

}

}catch(IOExceptione){

}catch(e){

System.out.println("输入错误!");

}

}

staticvoidlistAll()

{

tm.clear();

尝试{

fis=new("学生.dat");

ois=new(fis);

while((s=(Student)(ois.readObject()))!=null)

{

tm.put(s.stunum,s);

System.out.println(s.stunum""s.stuname);

}

ois.close();

}catch(IOExceptionioe){

}catch(c){

}

}

staticvoidinput(){

Stringstr1=null,str2=null;

尝试{

InputStreamReaderis=newInputStreamReader(System.in);

BufferedReaderbr=newBufferedReader(is);

System.out.print("请输入学号:");

str1=br.readLine();

System.out.print("请输入您的姓名:");

str2=br.readLine();

}catch(IOExceptione){

System.out.println(e);

}

s=newStudent(str1,str2);

tm.put(s.stunum,s);

//写文件

intn=1;

试试{

FileOutputStreamfos=newFileOutputStream("students.dat");

ObjectOutputStreamoos=newObjectOutputStream(fos);

for(Iteratorit=tm.values​​​​().iterator();it.hasNext();)

{

s=(Student)it.next();

oos.写对象;

}

oos.close();

}catch(IOExceptione){

System.out.println(e);

}

}

staticvoidsearch()

{

Stringkey=null;

try{

InputStreamReaderis=newInputStreamReader(System.in);

BufferedReaderbr=newBufferedReader(is);

System.out.print("请输入学生编号:");

key=br.readLine();

}catch(IOExceptione){

System.out.println(e);

}

if(tm.containsKey(key))

{

s=(学生)tm.get(key);

System.out.println(s.stunum""s.stuname);

}

else

<系统。 out.println("否");

}

staticvoiddelete()

{

Stringkey=null

try{

InputStreamReaderis=newInputStreamReader(System.in);

BufferedReaderbr=newBufferedReader(is);

System.out输入您的学号:“);

key=br.readLine();

}catch(IOExceptione){

}

if(tm.remove(key).equals(null))

{

System.out.println("否");

}

尝试{

FileOutputStreamfos=newFileOutputStream("students.dat");

ObjectOutputStreamoos=newObjectOutputStream(fos);

for(Iteratorit=tm.values().iterator();it.hasNext();)

{

s=(Student)it.next();

oos.writeObject(s);

}

oos.close();

}catch(IOExceptione){

System.out.println(e);

}

}

}

classStudentimplementsSerialized{

Stringstunum;

Stringstuname;

publicStudent(Stringstunum,Stringstuname){

this.stunum=stunum;

this.stuname=stuname;

}

}


用Java实现一个简单的学生管理系统!求代码,求代码!!!!
完成,希望对你有帮助
一开始会要求你输入选号功能
importjava.io.*;
publicclassstudent{
publicstaticvoidmain(Stringargs[])throwsIOException{
int[]stud={77,99,55,46,82,75,65,31,74,85};
System.out.println("请选择函数:");//输入数字选择函数
System.out.println("1.查看学生成绩输入学号:");
System.out.println("2.输入成绩并询问学生学号:");
System.out.println("3.学生输入学号并删除学号成绩");
System.out.println("请选择一个数字:");
BufferedReadertd=newBufferedReader(newInputStreamReader(System.in));
Stringtemp=td.readLine();
intchoice=Integer.valueOf(temp);
if(choice==1){//询问学生的成绩
System.out.println("请输入您的学号:");
BufferedReadersd=newBufferedReader(newInputStreamReader(System.in));
Stringtemp_sd=sd.readLine();
intNo=Integer.valueOf(temp_sd);
System.out.print(''学号学生的分数为"+no+":"+stud[number-1]+"分数");
}
if(choice==2){//第二个是查询学号
System.out.println("请输入分数:");
BufferedReadersd=newBufferedReader(newInputStreamReader(System.in));
StringChengji=sd.readLine();
inttemp_cj=Integer.valueOf(hengji);
for(inti=0;i if(temp_cj==stud[i]){
System.out.print(''+temp_cj+''年级学生学号为:"+(i+1));
}
}
}
if(choice==3){//删除操作有3个
System.out.println("请输入学号:");
BufferedReadersd=newBufferedReader(newInputStreamReader(System.in));
Stringtemp_sd=sd.readLine();
intNo=Integer.valueOf(temp_sd);
stud[No-1]=0;//直接赋值0,不删除学生
System.out.print('学号为'+No+'的学生,分数为:'+stud[No-1]+'分');
}
}
}
如何用java语言实现一学生信息管理系统?

定义一个类“Student”,代表学生信息。 要求如下:

(1)Student类的成员变量:

sNO代表学号;sSex代表性别;sAge代表年龄;sJava:代表Java课程成绩。

(2)Student类带参数的构造方法:

构造方法中,通过形参完成对成员变量的赋值。

(3)Student类的方法成员:

getNo():获取学号

getName():获取姓名

getSex():获取性别;

getAge()获取年龄;

getJava():获取Java课程成绩

(4)根据班级学生定义,创建该类的五个对象,输出每个学生的信息,计算并输出五个学生Java语言成绩的平均值,并计算他们的Java语言成绩的最大值和最小值以及输出你。 */