Java &引用;找不到符号“;在另一个类中尝试从main调用时

Java &引用;找不到符号“;在另一个类中尝试从main调用时,java,methods,Java,Methods,我对编码有点陌生,我有一个编码作业,可以帮助我们练习构造函数和类。我觉得我很精通我的水平,所以我来这里发布这篇文章是因为我被难住了。我在尝试执行CollegeGroup内部的方法printgetColleges(20))时,在Main中遇到一个错误。CollegeGroup应该是一组大学对象。20所大学的学费不超过2万美元。但是我得到了错误 找不到符号 符号:方法(int) 地点:班主 我需要更改什么才能正确打印getColleges(20))?谢谢你的帮助 College.java packa

我对编码有点陌生,我有一个编码作业,可以帮助我们练习构造函数和类。我觉得我很精通我的水平,所以我来这里发布这篇文章是因为我被难住了。我在尝试执行CollegeGroup内部的方法print
getColleges(20))
时,在Main中遇到一个错误。CollegeGroup应该是一组大学对象。20所大学的学费不超过2万美元。但是我得到了错误

找不到符号

符号:方法(int)

地点:班主

我需要更改什么才能正确打印
getColleges(20))
?谢谢你的帮助

College.java

package colleges;

public class College {

private int tuition;
private String name;
private String region;
private double minGPA;

public College(int aTuition, String aName, String aRegion, double minScore) {
    tuition = aTuition;
    name = aName;
    region = aRegion;
    minGPA = minScore;
}

public double getMinimumGPA() {
    return minGPA;
}

public String getName() {
    return name;
}

public int getTuition() {
    return tuition;
}

public String getRegion() {
    return region;
}

public void setTuition(int aTuition) {
    tuition = aTuition;
}

public String toString() {
    return ("College: " + name + "\tTuition: " + tuition
            + "\tRegion: " + region);
}
CollegeGroup.java

package colleges;    

import java.util.List;

import java.util.ArrayList;

public class CollegeGroup {

private List<College> colleges = new ArrayList<College>();

public void addCollege(College aCollege) {
    colleges.add(aCollege);
}

public void removeCollege(String collegeName) {
    for (int i = 0; i < colleges.size(); i++) {
        if (colleges.get(i).getName().equalsIgnoreCase(collegeName)) {
            colleges.remove(i);
        }
    }
}

public void updateTuition(String collegeName, int newTuition) {
    for (int i = 0; i < colleges.size(); i++) {
        if (colleges.get(i).getName().equalsIgnoreCase(collegeName)) {
            colleges.get(i).setTuition(newTuition);
        }
    }
}

public List<College> getColleges() {
    return colleges;
}

public List<College> getColleges(String region) {
    //return a list of colleges in the given region
    List<College> regionCollege = new ArrayList<College>();
    for (int i = 0; i < colleges.size(); i++) {
        if (colleges.get(i).getRegion().equalsIgnoreCase(region)) {
            regionCollege.add(colleges.get(i));
        }
    }
    return regionCollege;
}

public List<College> getColleges(int maxTuition) {
    //return a list of colleges with tuition below maxTuition
    List<College> mTut = new ArrayList<College>();
    for (int i = 0; i < colleges.size(); i++) {
        if (colleges.get(i).getTuition() < maxTuition) {
            mTut.add(colleges.get(i));
        }
    }
    return mTut;
}

public List<College> getColleges(double myGPA, int maxTuition) {
    //return a list of colleges with minimum GPA requirements below
    //myGPA, and tuitions below maxTuition
    List<College> perfCollege = new ArrayList<College>();
    for (int i = 0; i < colleges.size(); i++) {
        if (colleges.get(i).getTuition() < maxTuition && colleges.get(i).getMinimumGPA() <= myGPA) {
            perfCollege.add(colleges.get(i));
        }
    }
    return perfCollege;
}

public void sortCollegesByRegion() {
    //sort in the following order:
    //Northeast, Southeast, MidWest, West
    List<College> Northeast = new ArrayList<College>();
    List<College> Southeast = new ArrayList<College>();
    List<College> MidWest = new ArrayList<College>();
    List<College> West = new ArrayList<College>();
    for (int i = 0; i < colleges.size(); i++) {
        if (colleges.get(i).getRegion().equalsIgnoreCase("Northeast")) {
            Northeast.add(colleges.get(i));
        } else if (colleges.get(i).getRegion().equalsIgnoreCase("Southeast")) {
            Southeast.add(colleges.get(i));
        } else if (colleges.get(i).getRegion().equalsIgnoreCase("MidWest")) {
            MidWest.add(colleges.get(i));
        } else if (colleges.get(i).getRegion().equalsIgnoreCase("West")) {
            West.add(colleges.get(i));
        }
    }
}

public void sortCollegesByMinimumGPA() {
    //code goes here, sort from low to high.
    int smallest = Integer.MAX_VALUE;
    List<College> sorted = new ArrayList<College>();
    while (colleges.size() != 0) {
        for (int i = 0; i < colleges.size(); i++) {
            if (colleges.get(i).getMinimumGPA() < smallest) {
                sorted.add(colleges.get(i));
                colleges.remove(i);
            }
        }

    }
    sorted = colleges;
}

public void sortCollegesByTuition() {
    //code goes here, sort from low to high.
    int smallest = Integer.MAX_VALUE;
    List<College> sorted = new ArrayList<College>();
    while (colleges.size() != 0) {
        for (int i = 0; i < colleges.size(); i++) {
            if (colleges.get(i).getTuition() < smallest) {
                sorted.add(colleges.get(i));
                colleges.remove(i);
            }
        }

    }
    sorted = colleges;
}

public String toString() {
    String out = "";
    for (int i = 0; i < colleges.size(); i++) {
        out += colleges.get(i).toString(); //test whether toString is necessary on colleges.get()
        out += "\n";
    }
    return out.substring(0, out.length() - 1);
}

collegeList.getColleges(20)
oh my。我觉得自己像个白痴!我怎么会错过呢?非常感谢。现在很晚了。
package colleges;

public class Main {
public static void main(String[] args) {

    CollegeGroup collegeList = new CollegeGroup();
    College colUni = new College(17025,"College University", "Northeast", 2.3);
    College westCol = new College(28450,"Westcoast College", "West", 2.9);
    College budgCol = new College(700,"Budget College", "Southeast", 1.0);
    College goodUni = new College(95000,"Reallygood University", "Northeast", 3.9);
    College partyUni = new College(22150,"Partyschool U ", "West", 2.1);
    College hogwarts = new College(12000,"Hogwarts", "Northeast", 3.5);

    collegeList.addCollege(colUni);
    collegeList.addCollege(westCol);
    collegeList.addCollege(budgCol);
    collegeList.addCollege(goodUni);
    collegeList.addCollege(partyUni);
    collegeList.addCollege(hogwarts);
    System.out.println(collegeList.getColleges());
    System.out.println(colUni.toString());
    budgCol.setTuition(8);
    System.out.println(getColleges(20));


}