java语言,帮我写一个学生管理系统
时间: 2024-05-09 22:18:27 浏览: 98
好的,我可以为您提供一个基本的学生管理系统的Java代码示例。代码如下:
```
import java.util.Scanner;
public class StudentManagementSystem {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Welcome to the Student Management System!");
System.out.println("Please enter the number of students you want to manage:");
int numOfStudents = scanner.nextInt();
String[] names = new String[numOfStudents];
int[] ages = new int[numOfStudents];
String[] genders = new String[numOfStudents];
String[] courses = new String[numOfStudents];
int[] scores = new int[numOfStudents];
for (int i = 0; i < numOfStudents; i++) {
System.out.println("Please enter the name of student " + (i+1) + ":");
names[i] = scanner.next();
System.out.println("Please enter the age of student " + (i+1) + ":");
ages[i] = scanner.nextInt();
System.out.println("Please enter the gender of student " + (i+1) + ":");
genders[i] = scanner.next();
System.out.println("Please enter the course of student " + (i+1) + ":");
courses[i] = scanner.next();
System.out.println("Please enter the score of student " + (i+1) + ":");
scores[i] = scanner.nextInt();
}
System.out.println("******** Student Information ********");
for (int i = 0; i < numOfStudents; i++) {
System.out.println("Name: " + names[i]);
System.out.println("Age: " + ages[i]);
System.out.println("Gender: " + genders[i]);
System.out.println("Course: " + courses[i]);
System.out.println("Score: " + scores[i]);
System.out.println();
}
scanner.close();
}
}
```
这个学生管理系统允许您存储和查看学生的姓名、年龄、性别、课程和分数。您可以按照程序提示依次输入每个学生的信息,然后程序将打印出所有学生的详细信息。请注意,这只是一个基本的示例,您可以根据您的具体需求进行修改和扩展。
阅读全文