如何用Java语言编写学生成绩管理系统写过一个类似的给了你吧
package student;
import java.util.Scanner;
public class teststudent {
public static void main(String args[]){
System.out.println("************************学生成绩管理系统*********************");
System.out.println("请输入要管理的学生人数:");
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
studentMassage stum = new studentMassage(n);
int flag = 1;
while(flag == 1){
System.out.println("1.输入学生信息");
System.out.println("2.通过姓名查找学生信息");
System.out.println("3.显示全部学生信息");
System.out.println("4.退出系统");
int op = sc.nextInt();
switch(op){
case 1:stum.addStudent(n);
new Scanner(System.in).nextLine();
break;
case 2:
System.out.println("输入学生姓名:");
String name =sc.next();
stum.FindStudent(name);
new Scanner(System.in).nextLine();
break;
case 3:
stum.showallStudent();
new Scanner(System.in).nextLine();
break;
case 4:
flag = 0;
System.out.println("已退出系统!");
break;
default:
System.out.println("输入有误!");
new Scanner(System.in).nextLine();
}
}
}
}
class Date{
int year;
int month;
int day;
/*public Date(int year,int month,int day){
this.year = year;
this.month = month;
this.day = day;
}
public Date(){}*/
public String showDate(){
return year + "/"+ month+"/"+day;
}
}
class student{
int id;
String name;
Date date;
float score;
public student(){
id = 0;
name = null;
date = null;
score = 0f;
}
public void showStudent(){
System.out.println( id + " " + name + " "+ " " + date.showDate()+" "+score);
}
}
class studentMassage{
private student[] stu;
private int flag;
public studentMassage(int n){
flag = 0;
if(stu == null){
stu = new student[n];
for(int i =0;in;++i){
stu[i] = new student();
}
}
}
public void addStudent(int n){
flag = 1;
Scanner sc = new Scanner(System.in);
System.out.println("请输入"+n+"个学生信息");
for(int i = 0 ;istu.length;++i){
stu[i].date = new Date();
System.out.println("请输入第"+(i+1)+"个学生学号:");
stu[i].id = sc.nextInt();
System.out.println("请输入第"+(i+1)+"个学生姓名:");
stu[i].name = sc.next();
System.out.println("请输入第"+(i+1)+"个学生出生年份:");
stu[i].date.year = sc.nextInt();
System.out.println("请输入第"+(i+1)+"个学生出生月份:");
stu[i].date.month = sc.nextInt();
System.out.println("请输入第"+(i+1)+"个学生出生日期:");
stu[i].date.day = sc.nextInt();
//stu[i].date = new Date(year,month,day);
System.out.println("请输入第"+(i+1)+"个学生分数:");
stu[i].score = sc.nextFloat();
}
}
public void FindStudent(String sname){
student find = null;
if(flag != 0){
for(int i = 0;istu.length;++i){
if(sname.equals(stu[i].name))
find = stu[i];
}
if(find == null)
System.out.println("查无此人!");
else
find.showStudent();
}else
System.out.println("没有输入学生信息!");
}
public void showallStudent(){
System.out.println("所有学生的信息如下:");
System.out.println("学号姓名生日分数");
for(int i = 0;istu.length;++i){
stu[i].showStudent();
}
}
}
JAVA编写成绩管理有一个类似的 。
---------------------------------------
推荐阅读
- 云南区块链电子票据,云南区块链电子发票开错了怎么作废
- postgresql用户只读的简单介绍
- 怪物格斗苹果游戏下载,怪物格斗2下载
- php接收小程序数据 php小程序后端
- gis什么软件好,有哪些gis软件
- 模拟驾驶2游戏攻略答案,模拟驾驶2如何操作
- 怎么看mysql的账户名 如何看mysql的用户名
- 如何修改mysql表属性,mysql修改表的数据类型
- 代理浏览ip,代理浏览器