package studentmanagement;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class test {
public static void main(String[] args) {
System.out.println("请输入录入学生个数");
Scanner recv=new Scanner(System.in);
int n=Integer.parseInt(recv.nextLine());
System.out.println("请输入学生名字和成绩");
List list=new ArrayList();
for(int i=1;i<=n;i++) {
Student a=new Student();
System.out.println("第"+i+"个学生姓名");
String name=recv.nextLine();
a.setName(name);
System.out.println("第"+i+"个学生成绩");
double score=recv.nextDouble();
a.setScore(score);
recv.nextLine();
list.add(a);
}
for(Student a:list) {
System.out.println(a.getName()+"成绩为"+a.getScore());
}
}
}package studentmanagement;
public class Student extends person {
private double score;
public double getScore() {
return score;
}
public void setScore(double score) {
this.score = score;
}
}package studentmanagement;
public class person {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}