设计学生选课系统找不到mian方法如何修改?

img

import java.util.Scanner;
public class TextCourse {
private static void main(String[] args){
Teacher tea=new Teacher(1,"LXH");
Scanner input=new Scanner(System.in);
Course c1=new Course(input.next(),tea);
Course c2=new Course(input.next(),tea);
Student stu1=new Student(1,"张三");
Student stu2=new Student(2,"李四");
stu1.addCourse(c1);
c1.addStudent(stu1);
stu1.addCourse(c2);
c2.addStudent(stu1);
stu2.addCourse(c1);
c1.addStudent(stu2);
System.out.println(c1.toString());
System.out.println(stu1.toString());
}

}

class Course {
private int no;
private String name;
private Teacher teacher;
private Student[] stuList=new Student[100];
private int numberOfStudent;
public Course(){

}

public Course(String name, Teacher teacher) {
    this.name = name;
    this.teacher = teacher;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public Teacher getTeacher() {
    return teacher;
}

public void setTeacher(Teacher teacher) {
    this.teacher = teacher;
}

public Student[] getStuList() {
    return stuList;
}

public void setStuList(Student[] stuList) {
    this.stuList = stuList;
}

public int getNumberOfStudent() {
    return numberOfStudent;
}

public void setNumberOfStudent(int numberOfStudent) {
    this.numberOfStudent = numberOfStudent;
}
public void addStudent(Student stu){
    this.stuList[this.numberOfStudent++]=stu;
}
@Override
public String toString(){
    String strStuList="";
    for(int i=0;i<this.numberOfStudent;i++){
        strStuList+="学号"+this.stuList[i].getNo()+"姓名"+this.stuList[i].getName();
    }
    return name+"\n任课教师"+teacher.getName()+"\n选课学生\n"+strStuList;
}

}

class Student {
private int no;
private String name;
private Course[] courses=new Course[30];
private int numberOfCourse=0;

public int getNo() {
    return no;
}

public void setNo(int no) {
    this.no = no;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public Course[] getCourses() {
    return courses;
}

public void setCourses(Course[] courses) {
    this.courses = courses;
}

public int getNumberOfCourse() {
    return numberOfCourse;
}

public void setNumberOfCourse(int numberOfCourse) {
    this.numberOfCourse = numberOfCourse;
}


void addCourse(Course course){
    courses[numberOfCourse++]=course;
}
@Override
public String toString(){
    String strC="";
    for(int i=0;i<this.numberOfCourse;i++){
        strC=strC+this.courses[i].getName()+" ";
    }
    return"姓名"+name+"\n所选课程\n"+strC;
}

public Student(int no, String name) {
    this.no = no;
    this.name = name;
}
public Student(){
    
}

public static void main(String[] args) {
   
}

}
class Teacher {
private int no;
private String name;
private Course[] courseList=new Course[3];
private int numberOfCourse=0;

public Teacher(){
    
}
public Teacher(int no, String name) {
    this.no = no;
    this.name = name;
}

public int getNo() {
    return no;
}

public void setNo(int no) {
    this.no = no;
}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public Course[] getCourseList() {
    return courseList;
}

public void setCourseList(Course[] courseList) {
    this.courseList = courseList;
}

public int getNumberOfCourse() {
    return numberOfCourse;
}

public void setNumberOfCourse(int numberOfCourse) {
    this.numberOfCourse = numberOfCourse;
}
public void addCourse(Course course){
    if(this.numberOfCourse<=3)
    courseList[numberOfCourse++]=course;
    else
        System.out.println("一个教师授课不可超过3门");
}

}

你的是
private static void main(String[] args)
请改成
public static void main(String[] args)