java课外兴趣管理系统

题目了课外兴趣小组管理,
要求:
1)该系统主要处理课外兴趣小组的相关信息。
2)学生信息主要包括:学号、姓名、性别、兴趣爱好等内容。
3)兴趣主要包括:兴趣编号、兴趣类型等内容。
4)完成以下的操作:实现学生兴趣信息的添加、修改、删除和查询。
提示:
1)建立学生类、兴趣类、兴趣类型类。
2)学生、兴趣、兴趣类型信息的初始化。
3)学生、兴趣、兴趣类型信息的添加、修改、删除、查找
4〕学生兴趣信息的输出
5〉将学生兴趣信息保存为文件。

请问是要图形界面程序还是web项目

  • 这个问题的回答你可以参考下: https://ask.csdn.net/questions/7439167
  • 这篇博客也不错, 你可以看下前后端分离项目开发、生产环境跨域问题 and 项目部署、多项目部署问题及解决方案
  • 除此之外, 这篇博客: 2.6使用二维数组存储学生的数据,包括学号、姓名、操作系统成绩、Java成绩、高数成绩、总分;一行存储一个学生的数据;要求输入若干学生的数据,求出总分;然后按照总分由高到低重新排列;输出排序后的结果中的 6、使用二维数组存储学生的数据,包括学号、姓名、操作系统成绩、Java成绩、高数成绩、总分;一行存储一个学生的数据;要求输入若干学生的数据,求出总分;然后按照总分由高到低重新排列;输出排序后的结果。 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • 
    /**
     * @author 薛莲婷
     *使用二维数组存储学生的数据,包括学号、姓名、操作系统成绩、Java成绩、高数成绩、总分;一行存储一个学生的数据;
     *要求输入若干学生的数据,求出总分;然后按照总分由高到低重新排列;输出排序后的结果
     *
     */
    
    /*供复制以输入的学生信息:
    112 张一 98 70 78
    20 李二 98 0 1
    01 王三 98 78 29
    302 赵四 99 97 20
     */
    import java.util.*;
    
    class Assignment5 {
    
        public static void main(String[] args) {
            Scanner sc=new Scanner(System.in);
    
            System.out.println("请输入学生人数:");
    
            int n=sc.nextInt();
            String [][]student=new String[n][6];                    //学生信息的二位数组
    
            System.out.println("请输入学号、姓名、操作系统成绩、Java成绩、高数成绩:");
            for(int i=0;i<n;i++)
            {
                System.out.printf("第%d位学生:",i+1);
                for(int j=0;j<5;j++)
                {
                    student[i][j]=sc.next();                        //每位学生信息占一行
                }
            }
    
            float []sum=new float[n];                               //存放总分的一个float型数组
    
            for(int i=0;i<n;i++)                                    //计算每位学生的总分
            {
                sum[i]=Float.parseFloat(student[i][2])+Float.parseFloat(student[i][3])+Float.parseFloat(student[i][4]);
                student[i][5]=String.valueOf(sum[i]);               //将float型转为字符串存入原数组
            }
    
            float temp;
            String [][]p=new String[1][6];
            for(int i=0;i<n-1;i++)                                  //根据总分进行升序排序
            {
                int max=i;
                for(int j=i+1;j<n;j++)
                {
                    if(sum[max]<sum[j])
                    {
                        max=j;
                    }
    
                    temp=sum[max];
                    sum[max]=sum[j];
                    sum[j]=temp;
    
                    p[0]=student[max];
                    student[max]=student[j];
                    student[j]=p[0];
    
                }
            }
    
            System.out.println("按总分升序排列后的学生信息:\n学号\t姓名\t操作系统成绩\tJava成绩\t高数成绩\t总分");
            for(int i=0;i<n;i++)                                    //打印升序排列之后的学生信息
            {
                for(int j=0;j<6;j++)
                {
                    System.out.print(student[i][j]+"\t");
                }
                System.out.print("\n");
            }
            sc.close();
        }
    
    }
    
  • 以下回答由chatgpt基于相关博客总结生成:

    根据题目要求,需要设计一个课外兴趣管理系统,以下是具体的设计方案:

    1. 首先需要建立学生类、兴趣类、兴趣类型类,这里的类需要定义必要的属性和方法,并尽可能地使用封装和继承等面向对象的特性。
    2. 其次需要实现基本的读写数据功能,可以将数据保存在文件中,使用文件读写操作来实现读取和保存数据。
    3. 实现添加、修改、删除、查询等功能,这里可以采用面向对象的思想,在管理系统中添加一个操作类,并将各种操作集成到操作类中进行实现。
    4. 代码需要注重可读性和可维护性,在代码中增加必要的注释和文档说明,并进行适当的代码封装和代码重用。

    示例代码:

    // 建立学生类
    class Student {
        String id;          // 学号
        String name;        // 姓名
        String gender;      // 性别
        String hobby;       // 兴趣爱好
    
        public Student(String id, String name, String gender, String hobby) {
            this.id = id;
            this.name = name;
            this.gender = gender;
            this.hobby = hobby;
        }
    
        public String toString() {
            return "学号:" + id + ",姓名:" + name + ",性别:" + gender + ",兴趣爱好:" + hobby;
        }
    }
    
    // 建立兴趣类
    class Interest {
        int id;             // 兴趣编号
        String name;        // 兴趣名称
        String type;        // 兴趣类型
    
        public Interest(int id, String name, String type) {
            this.id = id;
            this.name = name;
            this.type = type;
        }
    
        public String toString() {
            return "兴趣编号:" + id + ",兴趣名称:" + name + ",兴趣类型:" + type;
        }
    }
    
    // 建立兴趣类型类
    class InterestType {
        int id;             // 兴趣类型编号
        String name;        // 兴趣类型名称
    
        public InterestType(int id, String name) {
            this.id = id;
            this.name = name;
        }
    
        public String toString() {
            return "兴趣类型编号:" + id + ",兴趣类型名称:" + name;
        }
    }
    
    // 建立操作类
    class Operation {
        List<Student> studentList;          // 学生列表
        List<Interest> interestList;        // 兴趣列表
        List<InterestType> interestTypeList;    // 兴趣类型列表
    
        public Operation() {
            studentList = new ArrayList<>();
            interestList = new ArrayList<>();
            interestTypeList = new ArrayList<>();
        }
    
        // 添加学生
        public void addStudent(Student student) {
            studentList.add(student);
        }
    
        // 修改学生信息
        public void modifyStudent(String id, String name, String gender, String hobby) {
            for (Student student : studentList) {
                if (student.id.equals(id)) {
                    student.name = name;
                    student.gender = gender;
                    student.hobby = hobby;
                    break;
                }
            }
        }
    
        // 删除学生
        public void deleteStudent(String id) {
            for (Student student : studentList) {
                if (student.id.equals(id)) {
                    studentList.remove(student);
                    break;
                }
            }
        }
    
        // 添加兴趣
        public void addInterest(Interest interest) {
            interestList.add(interest);
        }
    
        // 修改兴趣信息
        public void modifyInterest(int id, String name, String type) {
            for (Interest interest : interestList) {
                if (interest.id == id) {
                    interest.name = name;
                    interest.type = type;
                    break;
                }
            }
        }
    
        // 删除兴趣
        public void deleteInterest(int id) {
            for (Interest interest : interestList) {
                if (interest.id == id) {
                    interestList.remove(interest);
                    break;
                }
            }
        }
    
        // 添加兴趣类型
        public void addInterestType(InterestType interestType) {
            interestTypeList.add(interestType);
        }
    
        // 修改兴趣类型信息
        public void modifyInterestType(int id, String name) {
            for (InterestType interestType : interestTypeList) {
                if (interestType.id == id) {
                    interestType.name = name;
                    break;
                }
            }
        }
    
        // 删除兴趣类型
        public void deleteInterestType(int id) {
            for (InterestType interestType : interestTypeList) {
                if (interestType.id == id) {
                    interestTypeList.remove(interestType);
                    break;
                }
            }
        }
    
        // 按学号查询学生
        public List<Student> findStudentById(String id) {
            List<Student> result = new ArrayList<>();
            for (Student student : studentList) {
                if (student.id.equals(id)) {
                    result.add(student);
                }
            }
            return result;
        }
    
        // 按姓名查询学生
        public List<Student> findStudentByName(String name) {
            List<Student> result = new ArrayList<>();
            for (Student student : studentList) {
                if (student.name.equals(name)) {
                    result.add(student);
                }
            }
            return result;
        }
    
        // 查询所有学生
        public List<Student> findAllStudents() {
            return studentList;
        }
    
        // 按兴趣类型查询兴趣
        public List<Interest> findInterestByType(String type) {
            List<Interest> result = new ArrayList<>();
            for (Interest interest : interestList) {
                if (interest.type.equals(type)) {
                    result.add(interest);
                }
            }
            return result;
        }
    
        // 查询所有兴趣
        public List<Interest> findAllInterests() {
            return interestList;
        }
    
        // 按兴趣类型编号查询兴趣类型
        public List<InterestType> findInterestTypeById(int id) {
            List<InterestType> result = new ArrayList<>();
            for (InterestType interestType : interestTypeList) {
                if (interestType.id == id) {
                    result.add(interestType);
                }
            }
            return result;
        }
    
        // 查询所有兴趣类型
        public List<InterestType> findAllInterestTypes() {
            return interestTypeList;
        }
    
        // 将学生兴趣信息保存到文件中
        public void saveToFile(String filename) {
            try {
                FileWriter fileWriter = new FileWriter(filename);
                for (Student student : studentList) {
                    fileWriter.write(student.id + "," + student.name + "," + student.gender + "," + student.hobby + "\n");
                }
                fileWriter.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    
        // 从文件中读取学生兴趣信息
        public void loadFromFile(String filename) {
            try {
                FileReader fileReader = new FileReader(filename);
                BufferedReader bufferedReader = new BufferedReader(fileReader);
                String line;
                while ((line = bufferedReader.readLine()) != null) {
                    String[] items = line.split(",");
                    Student student = new Student(items[0], items[1], items[2], items[3]);
                    studentList.add(student);
                }
                bufferedReader.close();
                fileReader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    
    // 测试类
    class Test {
        public static void main(String[] args) {
            Operation operation = new Operation();
    
            // 添加学生
            operation.addStudent(new Student("1001", "张三", "男", "足球"));
            operation.addStudent(new Student("1002", "李四", "女", "篮球"));
            operation.addStudent(new Student("1003", "王五", "男", "羽毛球"));
    
            // 修改学生信息
            operation.modifyStudent("1001", "张三", "男", "游泳");
    
            // 删除学生
            operation.deleteStudent("1003");
    
            // 添加兴趣
            operation.addInterest(new Interest(1, "足球", "运动"));
            operation.addInterest(new Interest(2, "篮球", "运动"));
            operation.addInterest(new Interest(3, "旅游", "休闲"));
    
            // 修改兴趣信息
            operation.modifyInterest(1, "足球", "球类运动");
    
            // 删除兴趣
            operation.deleteInterest(3);
    
            // 添加兴趣类型
            operation.addInterestType(new InterestType(1, "运动"));
            operation.addInterestType(new InterestType(2, "休闲"));
    
            // 修改兴趣类型信息
            operation.modifyInterestType(1, "体育运动");
    
            // 删除兴趣类型
            operation.deleteInterestType(2);
    
            // 按学号查询学生
            List<Student> students = operation.findStudentById("1001");
    
            // 按姓名查询学生
            students = operation.findStudentByName("张三");
    
            // 查询所有学生
            students = operation.findAllStudents();
    
            // 按兴趣类型查询兴趣
            List<Interest> interests = operation.findInterestByType("运动");
    
            // 查询所有兴趣
            interests = operation.findAllInterests();
    
            // 按兴趣类型编号查询兴趣类型
            List<InterestType> interestTypes = operation.findInterestTypeById(1);
    
            // 查询所有兴趣类型
            interestTypes = operation.findAllInterestTypes();
    
            // 将学生兴趣信息保存到文件中
            operation.saveToFile("students.txt");
    
            // 从文件中读取学生兴趣信息
            operation.loadFromFile("students.txt");
        }
    }