本文实例为大家分享了java学生成绩管理系统的具体代码,供大家参考,具体内容如下
import java.util.Scanner;
import java.lang.*;
import java.io.*;
class Student
{
private static Student[] s=new Student[100]; //录入学生上限
int n=0;
private String name;
private int num;
private String classAge;
private int chinese;
private int math;
private int english;
//判断是否有录入学生信息
public void judge() throws IOException
{
int i;
char ch;
String str;
Scanner In=new Scanner(System.in);
if(n==0)
{
System.out.println("你还没有录入任何学生信息,是否录入(Y/N):");
str=In.next();
ch=str.charAt(0);
while(ch!='Y'&&ch!='y'&&ch!='N'&&ch!='n')
{
System.out.println("输入有误,请重新输入:");
str=In.next();
ch=str.charAt(0);
}
if(ch=='Y'||ch=='y')
{
this.add();
}
if(ch=='N'||ch=='n')
{
this.menu();
}
}
}
//菜单
public void menu() throws IOException //将异常抛出,调用这个方法去处理异常,如果main方法也将异常抛出,则交给Java虚拟机来处理,下同.
{
int a;
Scanner in=new Scanner(System.in);
System.out.println("*************学生信息管理系统*************");
System.out.println("***** 1.录入学生信息 ******");
System.out.println("***** 2.显示学生信息 ******");
System.out.println("***** 3.修改学生信息 ******");
System.out.println("***** 4.删除学生信息 ******");
System.out.println("***** 5.查看学生信息 ******");
System.out.println("***** 0.退出管理系统 ******");
System.out.println("******************************************");
System.out.print("请选择(0~5):");
a=in.nextInt();
while(a<0||a>5)
{
System.out.print("输入无效,请重新输入:");
a=in.nextInt();
}
switch(a)
{
case 1:this.add();break;
case 2:this.show();break;
case 3:this.modif();break;
case 4:this.delete();break;
case 5:this.look();break;
case 0:System.out.println("成功退出系统!!!");System.exit(0);break;
}
}
//录入学生信息
public void add() throws IOException
{
String str,str1,str2;
int i,num1,t=1;
char ch,ch1;
FileWriter fw=new FileWriter("E://student.txt",true); //将学生信息录入指定的txt文件中
fw.write(" 录入的学生信息列表rnrn学号 姓名 班级 语文成绩 数学成绩 英语成绩rn");
Scanner In=new Scanner(System.in);
while(t==1)
{
System.out.println("请输入学生学号:");
num1=In.nextInt();
//判断学号是否重复
for(i=0;i
部分效果图:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。



